def __init__(self, args): HarmonyLogging.configure() win32serviceutil.ServiceFramework.__init__(self, args) self.running = False
logging.info(string.join((name, 'On'), ' ')) self.harmonyApi.sendStateOn(name) else: logging.info(string.join((name, 'Off'), ' ')) self.harmonyApi.sendStateOff(name) return def wbMonitor(self, event): if self.Connected(): name = "wb" + str( event.fromNode()) + "_Monitor " + str(event.srcChannel() + 1) if (event.action() == 2): logging.info(string.join((name, 'Alarmed'), ' ')) self.harmonyApi.sendTrigger(name, "Alarmed") else: logging.info(string.join((name, 'Cleared'), ' ')) self.harmonyApi.sendTrigger(name, "Cleared") return # ------- --------- --------- --------- --------- --------- # Invoke main program # ------- --------- --------- --------- --------- --------- if __name__ == "__main__": HarmonyLogging.configure() Main = HarmonyMain() Main.start() while (Main.alive()): time.sleep(1)
if event.action() == 2: logging.info(string.join((name, "On"), " ")) self.harmonyApi.sendStateOn(name) else: logging.info(string.join((name, "Off"), " ")) self.harmonyApi.sendStateOff(name) return def wbMonitor(self, event): if self.Connected(): name = "wb" + str(event.fromNode()) + "_Monitor " + str(event.srcChannel() + 1) if event.action() == 2: logging.info(string.join((name, "Alarmed"), " ")) self.harmonyApi.sendTrigger(name, "Alarmed") else: logging.info(string.join((name, "Cleared"), " ")) self.harmonyApi.sendTrigger(name, "Cleared") return # ------- --------- --------- --------- --------- --------- # Invoke main program # ------- --------- --------- --------- --------- --------- if __name__ == "__main__": HarmonyLogging.configure() Main = HarmonyMain() Main.start() while Main.alive(): time.sleep(1)