#21 Add PowerOFF when print is finished

This commit is contained in:
David Zingg 2020-07-01 20:30:51 +02:00
parent 92fd2846ac
commit 0816056ded
2 changed files with 21 additions and 19 deletions

View File

@ -48,20 +48,6 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1574193087583</updated> <updated>1574193087583</updated>
</task> </task>
<task id="LOCAL-00037" summary="#8 Relais ein / ausschalten von Ocotprint aus">
<created>1574610253466</created>
<option name="number" value="00037" />
<option name="presentableId" value="LOCAL-00037" />
<option name="project" value="LOCAL" />
<updated>1574610253466</updated>
</task>
<task id="LOCAL-00038" summary="#9 Relais ausschalten wenn Octoprint heruntergefahren wird&#10;#7 Relais einschalten wenn Octoprint gestartet wurde">
<created>1574707150761</created>
<option name="number" value="00038" />
<option name="presentableId" value="LOCAL-00038" />
<option name="project" value="LOCAL" />
<updated>1574707150761</updated>
</task>
<task id="LOCAL-00039" summary="#9 Relais ausschalten wenn Octoprint heruntergefahren wird&#10;#7 Relais einschalten wenn Octoprint gestartet wurde"> <task id="LOCAL-00039" summary="#9 Relais ausschalten wenn Octoprint heruntergefahren wird&#10;#7 Relais einschalten wenn Octoprint gestartet wurde">
<created>1574707411686</created> <created>1574707411686</created>
<option name="number" value="00039" /> <option name="number" value="00039" />
@ -391,7 +377,21 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1593356663020</updated> <updated>1593356663020</updated>
</task> </task>
<option name="localTasksCounter" value="86" /> <task id="LOCAL-00086" summary="#21 Add PowerOFF when print is finished">
<created>1593627018087</created>
<option name="number" value="00086" />
<option name="presentableId" value="LOCAL-00086" />
<option name="project" value="LOCAL" />
<updated>1593627018088</updated>
</task>
<task id="LOCAL-00087" summary="#21 Add PowerOFF when print is finished">
<created>1593627195608</created>
<option name="number" value="00087" />
<option name="presentableId" value="LOCAL-00087" />
<option name="project" value="LOCAL" />
<updated>1593627195608</updated>
</task>
<option name="localTasksCounter" value="88" />
<servers /> <servers />
</component> </component>
<component name="UnknownFeatures"> <component name="UnknownFeatures">

View File

@ -75,13 +75,13 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
self._logger.debug("shutdownDelay: %s" % self.shutdownDelay) self._logger.debug("shutdownDelay: %s" % self.shutdownDelay)
self.rememberShutdown = self._settings.get_boolean(["rememberShutdown"]) self.rememberShutdown = self._settings.get_boolean(["rememberShutdown"])
self._logger.debug("rememberShutdown: %s" % self.rememberShutdown) self._logger.info("rememberShutdown: %s" % self.rememberShutdown)
self.lastPowerOff = self._settings.get_int(["lastPowerOff"]) self.lastPowerOff = self._settings.get_int(["lastPowerOff"])
self._logger.debug("lastPowerOff: %s" % self.lastPowerOff) self._logger.info("lastPowerOff: %s" % self.lastPowerOff)
self.lastShutdown = self._settings.get_int(["lastShutdown"]) self.lastShutdown = self._settings.get_int(["lastShutdown"])
self._logger.debug("lastShutdown: %s" % self.lastShutdown) self._logger.info("lastShutdown: %s" % self.lastShutdown)
if self.rememberShutdown: if self.rememberShutdown:
self.powerOffAfterPrintFinished = self.lastPowerOff self.powerOffAfterPrintFinished = self.lastPowerOff
@ -193,6 +193,8 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
data["automaticShutdownEnabled"] = self.shutdownAfterPrintFinished data["automaticShutdownEnabled"] = self.shutdownAfterPrintFinished
data["automaticPowerOffEnabled"] = self.powerOffAfterPrintFinished data["automaticPowerOffEnabled"] = self.powerOffAfterPrintFinished
self._plugin_manager.send_plugin_message(self._identifier, data) self._plugin_manager.send_plugin_message(self._identifier, data)
self._logger.info("automaticShutdownEnabled: %s" % self.automaticShutdownEnabled)
self._logger.info("automaticPowerOffEnabled: %s" % self.automaticPowerOffEnabled)
return return
except (requests.exceptions.ConnectionError, ValueError) as e: except (requests.exceptions.ConnectionError, ValueError) as e:
self._logger.exception(e) self._logger.exception(e)
@ -202,7 +204,7 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
self._logger.info("Ip is None") self._logger.info("Ip is None")
data = {"relay": True, "energy": 0, "onOffButtonEnabled": False, "showShutdownOctopiOption": False, data = {"relay": True, "energy": 0, "onOffButtonEnabled": False, "showShutdownOctopiOption": False,
"showPowerOffPrintFinishOption": False, "automaticShutdownEnabled": self.shutdownAfterPrintFinished, "showPowerOffPrintFinishOption": False, "automaticShutdownEnabled": self.shutdownAfterPrintFinished,
"v": self.powerOffAfterPrintFinished} "automaticPowerOffEnabled": self.powerOffAfterPrintFinished}
self._plugin_manager.send_plugin_message(self._identifier, data) self._plugin_manager.send_plugin_message(self._identifier, data)
def _setRelaisState(self, newState): def _setRelaisState(self, newState):