Your SlideShare is downloading. ×
0
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
R-House (LSRC)
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

R-House (LSRC)

741

Published on

R-House slides from the most excellent Lonestar RubyConf 2009.

R-House slides from the most excellent Lonestar RubyConf 2009.

Published in: Technology, Travel
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
741
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  1. r-house Fernand Galiana
  2. r-house Fernand Galiana
  3. credits darkfish-rdoc logging rails id3lib-ruby rfuzzrack twibot amqp boneschronicflexmock arrayfieldspassengertwitter4r jsonmainsinatramemcached ruleby toholio-serialportrake
  4. warning
  5. groups.google.com/group/derailed
  6. ZiYa git://github.com/derailed/ziya.git
  7. MOle git://github.com/derailed/mole.git
  8. homeautomation ?
  9. homeautomation ?
  10. telephonydigital media climate lightingav-equipmentsecurity
  11. 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
  12. opensource HA openremote control4 linuxmce mrhouse domotiga linuxha
  13. protocols X10 - Insteon LonWorks/Batibus ZigBee/Zwave
  14. linuxmce
  15. the gear
  16. Asus EEE Box MCV Zwave dongle Panasonic IP Cam Monster Cable Zwave dimmer HomeSeer Zwave sensor Arduino ( Eventual furniture? )
  17. > gem install derailed-rhouse git://github.com/derailed/rhouse.git
  18. DCE router
  19. DCE router 0 28 1 184 76 "50"
  20. DCE router 0 28 1 184 76 "50"
  21. DCE router 0 28 1 184 76 "50"
  22. DCE router 0 28 1 184 76 "50"
  23. DCE router 0 28 1 184 76 "50"
  24. DCE router 0 28 1 184 76 "50"
  25. DCE router 0 28 1 184 76 "50"
  26. architecture dce devices db
  27. architecture dce devices db
  28. architecture dce devices db
  29. architecture rh_interceptor dce devices db
  30. architecture rh_interceptor dce devices db
  31. architecture rh_interceptor rh_rhouse dce devices db
  32. architecture rh_interceptor rh_rhouse dce devices db
  33. architecture rh_interceptor rh_rhouse dce devices db
  34. architecture rh_interceptor
  35. architecture rh_interceptor rabbitMQ
  36. architecture rh_interceptor rabbitMQ
  37. architecture rh_interceptor rabbitMQ worker monitor rules engine
  38. architecture
  39. architecture house_rules
  40. architecture house_rules rh_rhouse
  41. architecture house_rules rh_rhouse
  42. architecture house_rules rh_rhouse
  43. architecture house_rules rh_rhouse
  44. @rhousse
  45. demo
  46. rh-interceptor def initialize( opts={} ) config = YAML.load_file( Rhouse.confpath( "interceptor.yml" ) ) @settings = config[Rhouse.environment] @settings['device_id'] = opts[:device_id] @settings['host'] = opts[:router] if opts[:router] end
  47. rh-interceptor common: &common port: 3450 dce_id: -1000 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
  48. 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( "COMMAND #{config(:interceptor)}n", 0 ) check_ok_response( in_socket, "Setting up command channel" ) out_socket.send( "EVENT #{config(:interceptor)}n", 0 ) check_ok_response( out_socket, "Setting up event channel" ) out_socket.send( "PLAIN_TEXTn", 0 ) check_ok_response( out_socket, "Registering plain text messages" ) end
  49. rh-interceptor def register_events events = config( :events ) events.each_pair do |event_id, message_type| command = "#{config(:device_id)} #{config(:dce_id)}” + “#{register_interceptor} 0 5 #{message_type} 4 #{event_id}" out_socket.send( "MESSAGET #{command.size}n#{command}n" , 0 ) check_ok_response( out_socket, "Registering #{event_id}" ) end end
  50. rhouse-app module MyRhouse class HouseRules < Rhouse::Worker # Fetch the yaml configuration file def configuration_file @config_file_name ||= MyRhouse.confpath( "#{config_file_name}.yml" ) 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
  51. 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 "n>>> [MATCH] Found Xine Event #{context[:event].device.Description}n" end end ...
  52. 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
  53. ws-client def send_cmd( command_hash ) params = command_hash.keys.map{ |k| "#{k}=#{command_hash[k]}" }.join("&") result = rhouse_service.post( '/cmd', :head => { "Content-type" => "application/x-www-form-urlencoded" }, :body => params ) unless result.http_status.index("2") == 0 text = result.http_reason raise "Error querying Rhouse web service: #{text}" end result.http_body rescue Errno::ECONNREFUSED raise "Could not contact the Rhouse web service" end
  54. demo
  55. references linuxmce.org z-wavealliance.org micasaverde.com
  56. 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
  57. Thanks!
  58. questions?

×