SlideShare a Scribd company logo
1 of 62
Download to read offline
r-house

                       Fernand Galiana

Friday, May 8, 2009
r-house

                       Fernand Galiana

Friday, May 8, 2009
credits
                         rfuzz
darkfish-rdoc logging
                        rack
      id3lib-ruby rails
beanstalk-client twibot
                     flexmock
  rake bones passenger
 arrayfields main sinatra
  json            twitter4r
     memcached
              system-timer
   ruleby
   toholio-serialport
Friday, May 8, 2009
warning

Friday, May 8, 2009
Friday, May 8, 2009
Friday, May 8, 2009
groups.google.com/group/derailed

Friday, May 8, 2009
ZiYa




                      git://github.com/derailed/ziya.git

Friday, May 8, 2009
MOle




                      git://github.com/derailed/mole.git

Friday, May 8, 2009
homeautomation

                        ?
Friday, May 8, 2009
homeautomation

                        ?
Friday, May 8, 2009
telephonydigital   media   climate


  lightingav-equipmentsecurity

Friday, May 8, 2009
Friday, May 8, 2009
Appliance     kWh / Year    Cost
                           Tv           240         $30
                         Fridge         500         $60
                           Dw           168         $20
                      Lamp(60w)         130         $16
                       MacBook           84         $10
                         24hrs
                        Washer           26          $6
                         Dryer          420         $50
                      Water Heater     2,832       $336
                        Furnace        2,232       $264
                          Total        6,632      $785.24

Friday, May 8, 2009
opensource HA

                         openremote
                         control4
                         linuxmce
                         mrhouse
                         domotiga
                         linuxha




Friday, May 8, 2009
protocols


                      X10 - Insteon
                      LonWorks/Batibus
                      ZigBee/Zwave




Friday, May 8, 2009
Friday, May 8, 2009
linuxmce
Friday, May 8, 2009
the gear
Friday, May 8, 2009
Asus EEE Box
                      MCV Zwave dongle
                      Panasonic IP Cam
                      Monster Cable Zwave dimmer
                      HomeSeer Zwave sensor
                      Arduino ( Eventual furniture? )


Friday, May 8, 2009
> gem install derailed-rhouse
                      git://github.com/derailed/rhouse.git




Friday, May 8, 2009
DCE router



Friday, May 8, 2009
DCE router
                      0 28 1 184 76 quot;50quot;


Friday, May 8, 2009
DCE router
                      0 28 1 184 76 quot;50quot;


Friday, May 8, 2009
DCE router
                      0 28 1 184 76 quot;50quot;


Friday, May 8, 2009
DCE router
                      0 28 1 184 76 quot;50quot;


Friday, May 8, 2009
DCE router
                      0 28 1 184 76 quot;50quot;


Friday, May 8, 2009
DCE router
                      0 28 1 184 76 quot;50quot;


Friday, May 8, 2009
DCE router
                      0 28 1 184 76 quot;50quot;


Friday, May 8, 2009
architecture


                                     devices
                           dce




                           db

Friday, May 8, 2009
architecture


                                     devices
                           dce




                           db

Friday, May 8, 2009
architecture


                                     devices
                           dce




                           db

Friday, May 8, 2009
architecture
                        rh_interceptor



                                         devices
                            dce




                             db

Friday, May 8, 2009
architecture
                        rh_interceptor



                                         devices
                            dce




                             db

Friday, May 8, 2009
architecture
                           rh_interceptor



             rh_rhouse                      devices
                               dce




                                db

Friday, May 8, 2009
architecture
                           rh_interceptor



             rh_rhouse                      devices
                               dce




                                db

Friday, May 8, 2009
architecture
                           rh_interceptor



             rh_rhouse                      devices
                               dce




                                db

Friday, May 8, 2009
architecture
                        rh_interceptor




Friday, May 8, 2009
architecture
                        rh_interceptor


                       beanstalk queue




Friday, May 8, 2009
architecture
                                 rh_interceptor


                                beanstalk queue

                                                  rhouse
                      worker
                                                    app



Friday, May 8, 2009
architecture
                                 rh_interceptor


                                beanstalk queue

                                                  rhouse
                      worker
                                                    app
                                  rules engine


Friday, May 8, 2009
architecture




Friday, May 8, 2009
architecture
                         house_rules




Friday, May 8, 2009
architecture
                         house_rules



                         rh_rhouse




Friday, May 8, 2009
architecture
                         house_rules



                         rh_rhouse




Friday, May 8, 2009
architecture
                         house_rules



                         rh_rhouse




Friday, May 8, 2009
architecture
                         house_rules



                         rh_rhouse




Friday, May 8, 2009
@rhousse

Friday, May 8, 2009
demo

Friday, May 8, 2009
rh-interceptor

            def initialize( opts={} )
              logger.debug quot;Initializing Interceptor in `#{Rhouse.environment}quot;
              # check required args
              raise quot;No interceptor id specifiedquot; unless opts[:interceptor]

              config    = YAML.load_file( Rhouse.confpath( quot;interceptor.ymlquot; ) )
              @settings = config[Rhouse.environment]
              @settings['interceptor'] = opts[:interceptor]
              @settings['host']        = opts[:router] if opts[:router]
            end




Friday, May 8, 2009
rh-interceptor
                        common: &common
                          port:           3450
                          dce_id:        -1000
                          beanstalk_port: 7777
                          sleep_interval: 30
                          events:
                            140: 1 # Camera
                            73: 1 # Lighting
                            84: 2 # Security
                            83: 2 # Climate
                            13: 2 # Media Players

                        development: *common
                          host:       rhouse
                        test:        *common
                          host:       localhost
                        production: *common
                          host:       localhost


Friday, May 8, 2009
rh-interceptor
              def connect
                @in_socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
                @out_socket = Socket.new( AF_INET, SOCK_STREAM, 0 )

                  in_socket.connect( Socket.pack_sockaddr_in( config(:port), config(:host) ) )
                  out_socket.connect( Socket.pack_sockaddr_in( config(:port), config(:host) ) )

                  in_socket.send( quot;COMMAND #{config(:interceptor)}nquot;, 0 )
                  check_ok_response( in_socket, quot;Setting up command channelquot; )

                  out_socket.send( quot;EVENT #{config(:interceptor)}nquot;, 0 )
                  check_ok_response( out_socket, quot;Setting up event channelquot; )

                out_socket.send( quot;PLAIN_TEXTnquot;, 0 )
                check_ok_response( out_socket, quot;Registering plain text messagesquot; )
              end




Friday, May 8, 2009
rh-interceptor

     def register_events
       events = config( :events )
       events.each_pair do |event_id, message_type|
         command = quot;#{config(:interceptor)} #{config(:dce_id)}” +
           “#{register_interceptor} 0 5 #{message_type} 4 #{event_id}quot;
         out_socket.send( quot;MESSAGET #{command.size}n#{command}nquot; , 0 )
         check_ok_response( out_socket, quot;Registering #{event_id}quot; )
       end
     end




Friday, May 8, 2009
rhouse-app
     module MyRhouse
       class HouseRules < Rhouse::Worker
         # Fetch the yaml configuration file
         def configuration_file
           @config_file_name ||= MyRhouse.confpath( quot;#{config_file_name}.ymlquot; )
         end

            # Handle event on queue. Parse event and create an associated event object
            # for the rules engine to consume.
            def handle_event( event )
              evt        = Rhouse::EventParser.parse( event )
              event_type = MyRhouse::Events::EventTypeFactory.create_event( evt )

           # fire up rule engine
           engine.evaluate( event_type )
         end
       end
     end



Friday, May 8, 2009
house-rules

 module MyRhouse::Rules
   class HouseRuleBook < Ruleby::Rulebook
     def rules
        # Deal with music
        rule [MyRhouse::Events::Generic, :event, m.description =~ /.*XinesPlayer.*/] do |context|
          cmd = case context[:event].command_id
            when 12 : 'b' # Play Back Completed
            when 58 : 'g' # Start playing
            when 22 : 'r' # Stop playing
          end
          MyRhouse::Plugins::Arduino.new.blink_light( cmd )
          logger.info quot;n>>> [MATCH] Found Xine Event #{context[:event].device.Description}nquot;
        end
    end
    ...




Friday, May 8, 2009
rhouse-ws
      # Initializes Rhouse
      configure do
        Rhouse.initialize(
          :environment => ENV['RH_ENV'] || 'development',
          :requires_db => true,
          :log_level   => :info,
      end

      # -----------------------------------------------------------------------------
      # send a command to the dce router via a post command
      post '/cmd' do
        Rhouse::Command.send_raw( keys_to_symbols( params ) )
      end




Friday, May 8, 2009
ws-client
           def send_cmd( command_hash )
             params = command_hash.keys.map{ |k| quot;#{k}=#{command_hash[k]}quot; }.join(quot;&quot;)
             result = rhouse_service.post( '/cmd',
               :head => { quot;Content-typequot; => quot;application/x-www-form-urlencodedquot; },
               :body => params )
             unless result.http_status.index(quot;2quot;) == 0
               text = result.http_reason
               raise quot;Error querying Rhouse web service: #{text}quot;
             end
             result.http_body
           rescue Errno::ECONNREFUSED
             raise quot;Could not contact the Rhouse web servicequot;
           end




Friday, May 8, 2009
demo

Friday, May 8, 2009
references

                      linuxmce.org
                      z-wavealliance.org
                      micasaverde.com




Friday, May 8, 2009
links

                      liquidrail.com
                      groups.google.com/group/rhouse_gem
                      github.com/derailed/rhouse.git
                      github.com/derailed/my_rhouse.git


                         fernand.galiana@gmail.com
                                  @kitesurfer

Friday, May 8, 2009
Thanks!


Friday, May 8, 2009
questions?




Friday, May 8, 2009

More Related Content

Similar to Rhouse - Home automation is ruby ?

Termtter 2009-03-14
Termtter 2009-03-14Termtter 2009-03-14
Termtter 2009-03-14jugyo kohno
 
Plone in the Cloud - an on-demand CMS hosted on Amazon EC2
Plone in the Cloud - an on-demand CMS hosted on Amazon EC2Plone in the Cloud - an on-demand CMS hosted on Amazon EC2
Plone in the Cloud - an on-demand CMS hosted on Amazon EC2Jazkarta, Inc.
 
State of Puppet
State of PuppetState of Puppet
State of PuppetPuppet
 
DjangoCon 2009 Keynote
DjangoCon 2009 KeynoteDjangoCon 2009 Keynote
DjangoCon 2009 KeynoteTed Leung
 
Atlassian - A Different Kind Of Software Company
Atlassian - A Different Kind Of Software CompanyAtlassian - A Different Kind Of Software Company
Atlassian - A Different Kind Of Software CompanyMike Cannon-Brookes
 
Chad Udell - Developers are from Mars, Designers are from Venus
Chad Udell - Developers are from Mars, Designers are from VenusChad Udell - Developers are from Mars, Designers are from Venus
Chad Udell - Developers are from Mars, Designers are from Venus360|Conferences
 
Code Quality in Ruby and Java
Code Quality in Ruby and JavaCode Quality in Ruby and Java
Code Quality in Ruby and JavaSteve Hayes
 
Tkinter Does Not Suck
Tkinter Does Not SuckTkinter Does Not Suck
Tkinter Does Not SuckRichard Jones
 
Mobile Web App Development
Mobile Web App DevelopmentMobile Web App Development
Mobile Web App DevelopmentBrian LeRoux
 
Google Web Toolkit for the Enterprise Developer - JBoss World 2009
Google Web Toolkit for the Enterprise Developer - JBoss World 2009Google Web Toolkit for the Enterprise Developer - JBoss World 2009
Google Web Toolkit for the Enterprise Developer - JBoss World 2009Fred Sauer
 
Libraries + Semantic Web = ?
Libraries + Semantic Web = ?Libraries + Semantic Web = ?
Libraries + Semantic Web = ?Richard Wallis
 
Encontro de TI - Arteccom
Encontro de TI - ArteccomEncontro de TI - Arteccom
Encontro de TI - ArteccomFabio Akita
 
Digital Imaging with Free Software - Talk at Sheffield Astronomical Society J...
Digital Imaging with Free Software - Talk at Sheffield Astronomical Society J...Digital Imaging with Free Software - Talk at Sheffield Astronomical Society J...
Digital Imaging with Free Software - Talk at Sheffield Astronomical Society J...Jan Wedekind
 
8/9 ustream講座 Ctwist+LadioCast
8/9 ustream講座 Ctwist+LadioCast8/9 ustream講座 Ctwist+LadioCast
8/9 ustream講座 Ctwist+LadioCastYuta Imada
 

Similar to Rhouse - Home automation is ruby ? (20)

Termtter 2009-03-14
Termtter 2009-03-14Termtter 2009-03-14
Termtter 2009-03-14
 
Plone in the Cloud - an on-demand CMS hosted on Amazon EC2
Plone in the Cloud - an on-demand CMS hosted on Amazon EC2Plone in the Cloud - an on-demand CMS hosted on Amazon EC2
Plone in the Cloud - an on-demand CMS hosted on Amazon EC2
 
State of Puppet
State of PuppetState of Puppet
State of Puppet
 
Rejectkaigi 2010
Rejectkaigi 2010Rejectkaigi 2010
Rejectkaigi 2010
 
DjangoCon 2009 Keynote
DjangoCon 2009 KeynoteDjangoCon 2009 Keynote
DjangoCon 2009 Keynote
 
Intro To Git
Intro To GitIntro To Git
Intro To Git
 
Atlassian - A Different Kind Of Software Company
Atlassian - A Different Kind Of Software CompanyAtlassian - A Different Kind Of Software Company
Atlassian - A Different Kind Of Software Company
 
Chad Udell - Developers are from Mars, Designers are from Venus
Chad Udell - Developers are from Mars, Designers are from VenusChad Udell - Developers are from Mars, Designers are from Venus
Chad Udell - Developers are from Mars, Designers are from Venus
 
Code Quality in Ruby and Java
Code Quality in Ruby and JavaCode Quality in Ruby and Java
Code Quality in Ruby and Java
 
Tkinter Does Not Suck
Tkinter Does Not SuckTkinter Does Not Suck
Tkinter Does Not Suck
 
Mobile Web App Development
Mobile Web App DevelopmentMobile Web App Development
Mobile Web App Development
 
Plone e Web 2.0
Plone e Web 2.0Plone e Web 2.0
Plone e Web 2.0
 
Google Web Toolkit for the Enterprise Developer - JBoss World 2009
Google Web Toolkit for the Enterprise Developer - JBoss World 2009Google Web Toolkit for the Enterprise Developer - JBoss World 2009
Google Web Toolkit for the Enterprise Developer - JBoss World 2009
 
Cloudera Desktop
Cloudera DesktopCloudera Desktop
Cloudera Desktop
 
Plone on Amazon EC2
Plone on Amazon EC2Plone on Amazon EC2
Plone on Amazon EC2
 
Libraries + Semantic Web = ?
Libraries + Semantic Web = ?Libraries + Semantic Web = ?
Libraries + Semantic Web = ?
 
Encontro de TI - Arteccom
Encontro de TI - ArteccomEncontro de TI - Arteccom
Encontro de TI - Arteccom
 
Digital Imaging with Free Software - Talk at Sheffield Astronomical Society J...
Digital Imaging with Free Software - Talk at Sheffield Astronomical Society J...Digital Imaging with Free Software - Talk at Sheffield Astronomical Society J...
Digital Imaging with Free Software - Talk at Sheffield Astronomical Society J...
 
8/9 ustream講座 Ctwist+LadioCast
8/9 ustream講座 Ctwist+LadioCast8/9 ustream講座 Ctwist+LadioCast
8/9 ustream講座 Ctwist+LadioCast
 
My Resume
My ResumeMy Resume
My Resume
 

More from Fernand Galiana

More from Fernand Galiana (11)

GraphQLUs For The RestOfUs!
GraphQLUs For The RestOfUs!GraphQLUs For The RestOfUs!
GraphQLUs For The RestOfUs!
 
Sailing into 2018 with Kubernetes and Istio
Sailing into 2018 with Kubernetes and IstioSailing into 2018 with Kubernetes and Istio
Sailing into 2018 with Kubernetes and Istio
 
GraphQL, The New Black?
GraphQL, The New Black?GraphQL, The New Black?
GraphQL, The New Black?
 
You, Mix and Kubee
You, Mix and KubeeYou, Mix and Kubee
You, Mix and Kubee
 
Docker Container Orchestration
Docker Container OrchestrationDocker Container Orchestration
Docker Container Orchestration
 
Bucket List Item #1246
Bucket List Item #1246Bucket List Item #1246
Bucket List Item #1246
 
In The Land Of Graphs...
In The Land Of Graphs...In The Land Of Graphs...
In The Land Of Graphs...
 
Engines
EnginesEngines
Engines
 
I motion
I motionI motion
I motion
 
What's new in Rails5?
What's new in Rails5?What's new in Rails5?
What's new in Rails5?
 
R-House (LSRC)
R-House (LSRC)R-House (LSRC)
R-House (LSRC)
 

Recently uploaded

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dashnarutouzumaki53779
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 

Recently uploaded (20)

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dash
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 

Rhouse - Home automation is ruby ?

  • 1. r-house Fernand Galiana Friday, May 8, 2009
  • 2. r-house Fernand Galiana Friday, May 8, 2009
  • 3. credits rfuzz darkfish-rdoc logging rack id3lib-ruby rails beanstalk-client twibot flexmock rake bones passenger arrayfields main sinatra json twitter4r memcached system-timer ruleby toholio-serialport Friday, May 8, 2009
  • 8. ZiYa git://github.com/derailed/ziya.git Friday, May 8, 2009
  • 9. MOle git://github.com/derailed/mole.git Friday, May 8, 2009
  • 10. homeautomation ? Friday, May 8, 2009
  • 11. homeautomation ? Friday, May 8, 2009
  • 12. telephonydigital media climate lightingav-equipmentsecurity Friday, May 8, 2009
  • 14. Appliance kWh / Year Cost Tv 240 $30 Fridge 500 $60 Dw 168 $20 Lamp(60w) 130 $16 MacBook 84 $10 24hrs Washer 26 $6 Dryer 420 $50 Water Heater 2,832 $336 Furnace 2,232 $264 Total 6,632 $785.24 Friday, May 8, 2009
  • 15. opensource HA openremote control4 linuxmce mrhouse domotiga linuxha Friday, May 8, 2009
  • 16. protocols X10 - Insteon LonWorks/Batibus ZigBee/Zwave Friday, May 8, 2009
  • 20. Asus EEE Box MCV Zwave dongle Panasonic IP Cam Monster Cable Zwave dimmer HomeSeer Zwave sensor Arduino ( Eventual furniture? ) Friday, May 8, 2009
  • 21. > gem install derailed-rhouse git://github.com/derailed/rhouse.git Friday, May 8, 2009
  • 23. DCE router 0 28 1 184 76 quot;50quot; Friday, May 8, 2009
  • 24. DCE router 0 28 1 184 76 quot;50quot; Friday, May 8, 2009
  • 25. DCE router 0 28 1 184 76 quot;50quot; Friday, May 8, 2009
  • 26. DCE router 0 28 1 184 76 quot;50quot; Friday, May 8, 2009
  • 27. DCE router 0 28 1 184 76 quot;50quot; Friday, May 8, 2009
  • 28. DCE router 0 28 1 184 76 quot;50quot; Friday, May 8, 2009
  • 29. DCE router 0 28 1 184 76 quot;50quot; Friday, May 8, 2009
  • 30. architecture devices dce db Friday, May 8, 2009
  • 31. architecture devices dce db Friday, May 8, 2009
  • 32. architecture devices dce db Friday, May 8, 2009
  • 33. architecture rh_interceptor devices dce db Friday, May 8, 2009
  • 34. architecture rh_interceptor devices dce db Friday, May 8, 2009
  • 35. architecture rh_interceptor rh_rhouse devices dce db Friday, May 8, 2009
  • 36. architecture rh_interceptor rh_rhouse devices dce db Friday, May 8, 2009
  • 37. architecture rh_interceptor rh_rhouse devices dce db Friday, May 8, 2009
  • 38. architecture rh_interceptor Friday, May 8, 2009
  • 39. architecture rh_interceptor beanstalk queue Friday, May 8, 2009
  • 40. architecture rh_interceptor beanstalk queue rhouse worker app Friday, May 8, 2009
  • 41. architecture rh_interceptor beanstalk queue rhouse worker app rules engine Friday, May 8, 2009
  • 43. architecture house_rules Friday, May 8, 2009
  • 44. architecture house_rules rh_rhouse Friday, May 8, 2009
  • 45. architecture house_rules rh_rhouse Friday, May 8, 2009
  • 46. architecture house_rules rh_rhouse Friday, May 8, 2009
  • 47. architecture house_rules rh_rhouse Friday, May 8, 2009
  • 50. rh-interceptor def initialize( opts={} ) logger.debug quot;Initializing Interceptor in `#{Rhouse.environment}quot; # check required args raise quot;No interceptor id specifiedquot; unless opts[:interceptor] config = YAML.load_file( Rhouse.confpath( quot;interceptor.ymlquot; ) ) @settings = config[Rhouse.environment] @settings['interceptor'] = opts[:interceptor] @settings['host'] = opts[:router] if opts[:router] end Friday, May 8, 2009
  • 51. rh-interceptor common: &common port: 3450 dce_id: -1000 beanstalk_port: 7777 sleep_interval: 30 events: 140: 1 # Camera 73: 1 # Lighting 84: 2 # Security 83: 2 # Climate 13: 2 # Media Players development: *common host: rhouse test: *common host: localhost production: *common host: localhost Friday, May 8, 2009
  • 52. rh-interceptor def connect @in_socket = Socket.new( AF_INET, SOCK_STREAM, 0 ) @out_socket = Socket.new( AF_INET, SOCK_STREAM, 0 ) in_socket.connect( Socket.pack_sockaddr_in( config(:port), config(:host) ) ) out_socket.connect( Socket.pack_sockaddr_in( config(:port), config(:host) ) ) in_socket.send( quot;COMMAND #{config(:interceptor)}nquot;, 0 ) check_ok_response( in_socket, quot;Setting up command channelquot; ) out_socket.send( quot;EVENT #{config(:interceptor)}nquot;, 0 ) check_ok_response( out_socket, quot;Setting up event channelquot; ) out_socket.send( quot;PLAIN_TEXTnquot;, 0 ) check_ok_response( out_socket, quot;Registering plain text messagesquot; ) end Friday, May 8, 2009
  • 53. rh-interceptor def register_events events = config( :events ) events.each_pair do |event_id, message_type| command = quot;#{config(:interceptor)} #{config(:dce_id)}” + “#{register_interceptor} 0 5 #{message_type} 4 #{event_id}quot; out_socket.send( quot;MESSAGET #{command.size}n#{command}nquot; , 0 ) check_ok_response( out_socket, quot;Registering #{event_id}quot; ) end end Friday, May 8, 2009
  • 54. rhouse-app module MyRhouse class HouseRules < Rhouse::Worker # Fetch the yaml configuration file def configuration_file @config_file_name ||= MyRhouse.confpath( quot;#{config_file_name}.ymlquot; ) end # Handle event on queue. Parse event and create an associated event object # for the rules engine to consume. def handle_event( event ) evt = Rhouse::EventParser.parse( event ) event_type = MyRhouse::Events::EventTypeFactory.create_event( evt ) # fire up rule engine engine.evaluate( event_type ) end end end Friday, May 8, 2009
  • 55. house-rules module MyRhouse::Rules class HouseRuleBook < Ruleby::Rulebook def rules # Deal with music rule [MyRhouse::Events::Generic, :event, m.description =~ /.*XinesPlayer.*/] do |context| cmd = case context[:event].command_id when 12 : 'b' # Play Back Completed when 58 : 'g' # Start playing when 22 : 'r' # Stop playing end MyRhouse::Plugins::Arduino.new.blink_light( cmd ) logger.info quot;n>>> [MATCH] Found Xine Event #{context[:event].device.Description}nquot; end end ... Friday, May 8, 2009
  • 56. rhouse-ws # Initializes Rhouse configure do Rhouse.initialize( :environment => ENV['RH_ENV'] || 'development', :requires_db => true, :log_level => :info, end # ----------------------------------------------------------------------------- # send a command to the dce router via a post command post '/cmd' do Rhouse::Command.send_raw( keys_to_symbols( params ) ) end Friday, May 8, 2009
  • 57. ws-client def send_cmd( command_hash ) params = command_hash.keys.map{ |k| quot;#{k}=#{command_hash[k]}quot; }.join(quot;&quot;) result = rhouse_service.post( '/cmd', :head => { quot;Content-typequot; => quot;application/x-www-form-urlencodedquot; }, :body => params ) unless result.http_status.index(quot;2quot;) == 0 text = result.http_reason raise quot;Error querying Rhouse web service: #{text}quot; end result.http_body rescue Errno::ECONNREFUSED raise quot;Could not contact the Rhouse web servicequot; end Friday, May 8, 2009
  • 59. references linuxmce.org z-wavealliance.org micasaverde.com Friday, May 8, 2009
  • 60. links liquidrail.com groups.google.com/group/rhouse_gem github.com/derailed/rhouse.git github.com/derailed/my_rhouse.git fernand.galiana@gmail.com @kitesurfer Friday, May 8, 2009