if os.name == "nt": class MainService(pluginapi.WindowsService): ''' This is the main service definition for HouseAgent. It takes care of running HouseAgent as Windows Service. ''' _svc_name_ = "hamain" _svc_display_name_ = "HouseAgent - Main Service" def start(self): main = MainWrapper() main.start() if __name__ == '__main__': config = Config(config_file) if os.name == "nt": if config.general.runasservice: pluginapi.handle_windowsservice( MainService ) # We want to start as a Windows service on Windows. else: main = MainWrapper() main.start() else: main = MainWrapper() main.start()
self.log.info("Dusk in {0} minutes".format(-(delta // 60))) self.pluginapi.value_update("1", {"Dusk delta": delta // 60}) delta = int(time.time()) - int(time.mktime(sun["noon"].timetuple())) + 30 if delta > 0: self.log.info("Solar noon was {0} minutes ago".format(delta // 60)) else: self.log.info("Solar noon in {0} minutes".format(-(delta // 60))) self.pluginapi.value_update("1", {"Solar noon delta": delta // 60}) if os.name == 'nt': class AstralService(pluginapi.WindowsService): ''' This class provides a Windows Service interface for the Astral plugin. ''' _svc_name_ = "haAstral" _svc_display_name_ = "HouseAgent - Astral Service" def start(self): ''' Start the Astral interface. ''' AstralWrapper() if __name__ == '__main__': if os.name == 'nt': # We want to start as a Windows service on Windows. pluginapi.handle_windowsservice(AstralService) else: AstralWrapper()
else: reactor.run() return True if os.name == "nt": class MainService(pluginapi.WindowsService): ''' This is the main service definition for HouseAgent. It takes care of running HouseAgent as Windows Service. ''' _svc_name_ = "hamain" _svc_display_name_ = "HouseAgent - Main Service" def start(self): main = MainWrapper() main.start() if __name__ == '__main__': config = Config(config_file) if os.name == "nt": if config.general.runasservice: pluginapi.handle_windowsservice(MainService) # We want to start as a Windows service on Windows. else: main = MainWrapper() main.start() else: main = MainWrapper() main.start()
self.poll_timer.start() # Notify HouseAgent that we are ready. self.pluginapi.ready() if os.name == 'nt': class ZwaveService(pluginapi.WindowsService): ''' This class provides a Windows Service ozw_interface for the z-wave plugin. ''' _svc_name_ = "hazwave" _svc_display_name_ = "HouseAgent - Zwave Service" def start(self): ''' Start the Zwave ozw_interface. ''' ZwaveWrapper() if __name__ == '__main__': if os.name == 'nt': # We want to start as a Windows service on Windows. pluginapi.handle_windowsservice(ZwaveService) else: zwave = ZwaveWrapper() reactor.run()