#NEWLINE# def run( self ) : #NEWLINE# #INDENT# self . _push_rpc = pushrpc . PushRPC ( self . _push_event_callback , self . _args ) #NEWLINE# self . _proxies = { #NEWLINE# #INDENT# 'hue' : hue . Hue ( self . _args . hue_scan_interval_secs , self . _device_event_callback ) , #NEWLINE# 'wemo' : wemo . Wemo ( self . _args . hue_scan_interval_secs , self . _device_event_callback ) , #NEWLINE# 'sonos' : sonos . Sonos ( self . _args . hue_scan_interval_secs , self . _device_event_callback ) , #NEWLINE# #UNINDENT# } #NEWLINE# try : #NEWLINE# #INDENT# from pi import network #NEWLINE# self . _proxies [ 'network' ] = network . NetworkMonitor ( self . _device_event_callback , self . _args . network_scan_interval_secs , self . _args . network_scan_timeout_secs ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# logging . debug ( 'Exception was:' , exc_info = sys . exc_info ( ) ) #NEWLINE# logging . error ( 'Failed to initialize network module - did you run as root?' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# from pi import rfswitch #NEWLINE# self . _proxies [ 'rfswitch' ] = rfswitch . RFSwitch ( self . _args . rfswtich_pin ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# logging . debug ( 'Exception was:' , exc_info = sys . exc_info ( ) ) #NEWLINE# logging . error ( 'Failed to initialize rfswitch module - have you installed rcswitch?' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# from pi import zwave #NEWLINE# self . _proxies [ 'zwave' ] = zwave . ZWave ( self . _args . zwave_device , self . _device_event_callback ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# logging . debug ( 'Exception was:' , exc_info = sys . exc_info ( ) ) #NEWLINE# logging . error ( 'Failed to initialize zwave module - have you installed libopenzwave?' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# events . run ( ) #NEWLINE# #UNINDENT# except KeyboardInterrupt : #NEWLINE# #INDENT# logging . info ( 'Shutting down' ) #NEWLINE# #UNINDENT# self . _push_rpc . stop ( ) #NEWLINE# for proxy in self . _proxies . itervalues ( ) : #NEWLINE# #INDENT# proxy . stop ( ) #NEWLINE# #UNINDENT# for proxy in self . _proxies . itervalues ( ) : #NEWLINE# #INDENT# proxy . join ( )