rhouse - home automation is ruby ?
DESCRIPTION
Home automation using ruby. Control various devices around your house, using your iphone and yes even twitter...TRANSCRIPT
r-house
Fernand Galiana
Friday, May 8, 2009
r-house
Fernand Galiana
Friday, May 8, 2009
creditsrails
arrayfieldsbones
beanstalk-client
darkfish-rdoc
flexmocksinatra
logging
memcached
passenger
ruleby
twibot
system-timermain twitter4r
rake
id3lib-ruby
json
toholio-serialport
rackrfuzz
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 mediaclimate
securityav-equipmentlighting
Friday, May 8, 2009
Friday, May 8, 2009
Appliance kWh / Year CostTv 240 $30
Fridge 500 $60Dw 168 $20
Lamp(60w) 130 $16MacBook
24hrs84 $10
Washer 26 $6Dryer 420 $50
Water Heater 2,832 $336Furnace 2,232 $264
Total 6,632 $785.24
Friday, May 8, 2009
opensource HA
openremotecontrol4linuxmcemrhousedomotigalinuxha
Friday, May 8, 2009
protocols
X10 - InsteonLonWorks/BatibusZigBee/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-rhousegit://github.com/derailed/rhouse.git
Friday, May 8, 2009
DCE router
Friday, May 8, 2009
DCE router0 28 1 184 76 "50"
Friday, May 8, 2009
DCE router0 28 1 184 76 "50"
Friday, May 8, 2009
DCE router0 28 1 184 76 "50"
Friday, May 8, 2009
DCE router0 28 1 184 76 "50"
Friday, May 8, 2009
DCE router0 28 1 184 76 "50"
Friday, May 8, 2009
DCE router0 28 1 184 76 "50"
Friday, May 8, 2009
DCE router0 28 1 184 76 "50"
Friday, May 8, 2009
dce
architecture
db
devices
Friday, May 8, 2009
dce
architecture
db
devices
Friday, May 8, 2009
dce
architecture
db
devices
Friday, May 8, 2009
dce
rh_interceptor
architecture
db
devices
Friday, May 8, 2009
dce
rh_interceptor
architecture
db
devices
Friday, May 8, 2009
dce
rh_interceptor
architecture
db
devicesrh_rhouse
Friday, May 8, 2009
dce
rh_interceptor
architecture
db
devicesrh_rhouse
Friday, May 8, 2009
dce
rh_interceptor
architecture
db
devicesrh_rhouse
Friday, May 8, 2009
rh_interceptor
architecture
Friday, May 8, 2009
rh_interceptor
beanstalk queue
architecture
Friday, May 8, 2009
rh_interceptor
beanstalk queue
worker rhouseapp
architecture
Friday, May 8, 2009
rh_interceptor
beanstalk queue
worker rhouseapp
architecture
rules engine
Friday, May 8, 2009
architecture
Friday, May 8, 2009
house_rules
architecture
Friday, May 8, 2009
house_rules
rh_rhouse
architecture
Friday, May 8, 2009
house_rules
rh_rhouse
architecture
Friday, May 8, 2009
house_rules
rh_rhouse
architecture
Friday, May 8, 2009
house_rules
rh_rhouse
architecture
Friday, May 8, 2009
@rhousse
Friday, May 8, 2009
demo
Friday, May 8, 2009
rh-interceptor
def initialize( opts={} ) logger.debug "Initializing Interceptor in `#{Rhouse.environment}" # check required args raise "No interceptor id specified" unless opts[:interceptor] config = YAML.load_file( Rhouse.confpath( "interceptor.yml" ) ) @settings = config[Rhouse.environment] @settings['interceptor'] = opts[:interceptor] @settings['host'] = opts[:router] if opts[:router] end
Friday, May 8, 2009
rh-interceptorcommon: &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: rhousetest: *common host: localhostproduction: *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( "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_TEXT\n", 0 ) check_ok_response( out_socket, "Registering plain text messages" ) end
Friday, May 8, 2009
rh-interceptor
def register_events events = config( :events ) events.each_pair do |event_id, message_type| command = "#{config(:interceptor)} #{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
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( "#{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 endend
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 =~ /.*Xine\sPlayer.*/] 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 ...
Friday, May 8, 2009
rhouse-ws
# Initializes Rhouseconfigure 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 commandpost '/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| "#{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
Friday, May 8, 2009
demo
Friday, May 8, 2009
references
linuxmce.orgz-wavealliance.orgmicasaverde.com
Friday, May 8, 2009
liquidrail.comgroups.google.com/group/rhouse_gemgithub.com/derailed/rhouse.gitgithub.com/derailed/my_rhouse.git
[email protected]@kitesurfer
links
Friday, May 8, 2009
Thanks!
Friday, May 8, 2009
questions?
Friday, May 8, 2009