#9 Relais ausschalten wenn Octoprint heruntergefahren wird

#7 Relais einschalten wenn Octoprint gestartet wurde
This commit is contained in:
David Zingg 2019-11-25 19:43:31 +01:00
parent 9eca03c29c
commit c9d706e603

View File

@ -139,13 +139,16 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
def on_after_startup(self): def on_after_startup(self):
if self.powerOnOnStart: if self.powerOnOnStart:
self._logger.info("Turn on Relais on Start")
self._setRelaisState(True) self._setRelaisState(True)
def on_shutdown(self): def on_shutdown(self):
if self.powerOffOnShutdown: if self.powerOffOnShutdown:
if self.powerOffDelay <= 0: if self.powerOffDelay <= 0:
self._logger.info("Turn on Relais off Shutdown")
self._setRelaisState(False) self._setRelaisState(False)
else: else:
self._logger.info("Turn on Relais off Shutdown Delayed")
self._powerCycleRelais(False, self.powerOffDelay) self._powerCycleRelais(False, self.powerOffDelay)
def on_settings_migrate(self, target, current): def on_settings_migrate(self, target, current):