def __init__(self): self.harmonyApi = Harmony.Harmony(self) self.wbUdpEvents = wbUdpEvents.wbUdpEvents(self) self.ZonesByName = {} self.ZonesById = {} self.DevicesByName = {} self.DevicesById = {}
def SetTime( args ): # WbCfg(sys.argv[1:]) logging.info( "Starting" ) setter = setTime() events = wbUdpEvents.wbUdpEvents( setter ) events.startMonitor() while ( setter.timeVal > 0 ): logging.info( string.join(('running ', str(setter.timeVal) ) ) ) setter.timeVal = setter.timeVal - 1 time.sleep(1) events.shutdown()
import sys sys.path.append('../API') # # Harmony to webbrick interface main code # import logging import wbUdpEvents, wbXmlEvent import string logging.basicConfig(level=logging.INFO) #logging.basicConfig(level=logging.INFO, # format='%(asctime)s %(levelname)s %(message)s', # filename='./WebBrickMonitor.log', # filemode='w') class myTarget( wbXmlEvent.wbXmlTarget ): def __init__(self): logging.info( 'WebBrick Xml Events' ) def XmlEvent( self, Xml ): logging.info( Xml ) return udp = wbUdpEvents.wbUdpEvents( wbXmlEvent.wbXmlEvent( myTarget() ) ) udp.startMonitor()
import sys sys.path.append('../API') # # Harmony to webbrick interface main code # import logging import wbUdpEvents, wbXmlEvent import string logging.basicConfig(level=logging.INFO) #logging.basicConfig(level=logging.INFO, # format='%(asctime)s %(levelname)s %(message)s', # filename='./WebBrickMonitor.log', # filemode='w') class myTarget(wbXmlEvent.wbXmlTarget): def __init__(self): logging.info('WebBrick Xml Events') def XmlEvent(self, Xml): logging.info(Xml) return udp = wbUdpEvents.wbUdpEvents(wbXmlEvent.wbXmlEvent(myTarget())) udp.startMonitor()
def wbRemoteDigIn(self, event): logging.info(string.join(('Remote Digital In', self.allValues(event)))) def wbScheduled(self, event): logging.info(string.join(('Scheduled Event', self.allValues(event)))) def wbAnIn(self, event): logging.info( string.join(('Analogue In', self.source(event), "Value ", str(event.val())))) def wbAnOut(self, event): logging.info( string.join(('Analogue Out', self.source(event), "Value ", str(event.val())))) def wbDigOut(self, event): logging.info( string.join(('wbDigOut', self.source(event), str(event.action())))) def wbMonitor(self, event): logging.info(string.join(('wbMonitor', self.source(event)))) tgt = myTarget() udp = wbUdpEvents.wbUdpEvents(tgt) udp.startMonitor() while (udp.alive()): time.sleep(0.5)
def wbTempIn( self, event ): logging.info( string.join( ('Temperature',self.source(event),"Value ",str(event.val()/16.0) ) ) ) def wbDigIn( self, event ): logging.info( string.join( ('Digital In',self.allValues( event ),"Count ",str(event.val()) ) ) ) def wbRemoteDigIn( self, event ): logging.info( string.join( ('Remote Digital In',self.allValues( event ) ) ) ) def wbScheduled( self, event ): logging.info( string.join( ('Scheduled Event',self.allValues( event ) ) ) ) def wbAnIn( self, event ): logging.info( string.join( ('Analogue In',self.source(event),"Value ",str(event.val()) ) ) ) def wbAnOut( self, event ): logging.info( string.join( ('Analogue Out',self.source(event),"Value ",str(event.val()) ) ) ) def wbDigOut( self, event ): logging.info( string.join( ('wbDigOut',self.source(event),str(event.action()) ) ) ) def wbMonitor( self, event ): logging.info( string.join( ('wbMonitor',self.source(event) ) ) ) tgt = myTarget() udp = wbUdpEvents.wbUdpEvents( tgt ) udp.startMonitor() while ( udp.alive() ): time.sleep( 0.5 )