#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

30
.idea/workspace.xml generated
View File

@ -48,20 +48,6 @@
<option name="presentableId" value="Default" />
<updated>1574193087583</updated>
</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">
<created>1574707411686</created>
<option name="number" value="00039" />
@ -391,7 +377,21 @@
<option name="project" value="LOCAL" />
<updated>1593356663020</updated>
</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 />
</component>
<component name="UnknownFeatures">

View File

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