#21 Add PowerOFF when print is finished

This commit is contained in:
David Zingg 2020-07-01 20:43:34 +02:00
parent af7a581620
commit c9608fa24f
2 changed files with 13 additions and 8 deletions

View File

@ -2,6 +2,7 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="7e2e0eec-b22e-4d48-8f24-196d1ed9b51a" name="Default Changelist" comment=""> <list default="true" id="7e2e0eec-b22e-4d48-8f24-196d1ed9b51a" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/octoprint_mystromswitch/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/octoprint_mystromswitch/__init__.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/octoprint_mystromswitch/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/octoprint_mystromswitch/__init__.py" afterDir="false" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@ -47,13 +48,6 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1574193087583</updated> <updated>1574193087583</updated>
</task> </task>
<task id="LOCAL-00041" summary="#9 Relais ausschalten wenn Octoprint heruntergefahren wird&#10;#7 Relais einschalten wenn Octoprint gestartet wurde">
<created>1574708023156</created>
<option name="number" value="00041" />
<option name="presentableId" value="LOCAL-00041" />
<option name="project" value="LOCAL" />
<updated>1574708023156</updated>
</task>
<task id="LOCAL-00042" summary="#9 Relais ausschalten wenn Octoprint heruntergefahren wird&#10;#7 Relais einschalten wenn Octoprint gestartet wurde&#10;&#10;Api call fix"> <task id="LOCAL-00042" summary="#9 Relais ausschalten wenn Octoprint heruntergefahren wird&#10;#7 Relais einschalten wenn Octoprint gestartet wurde&#10;&#10;Api call fix">
<created>1574708245896</created> <created>1574708245896</created>
<option name="number" value="00042" /> <option name="number" value="00042" />
@ -390,7 +384,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1593628347105</updated> <updated>1593628347105</updated>
</task> </task>
<option name="localTasksCounter" value="90" /> <task id="LOCAL-00090" summary="#21 Add PowerOFF when print is finished">
<created>1593628617461</created>
<option name="number" value="00090" />
<option name="presentableId" value="LOCAL-00090" />
<option name="project" value="LOCAL" />
<updated>1593628617461</updated>
</task>
<option name="localTasksCounter" value="91" />
<servers /> <servers />
</component> </component>
<component name="UnknownFeatures"> <component name="UnknownFeatures">

View File

@ -281,21 +281,25 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
self.shutdownAfterPrintFinished = True self.shutdownAfterPrintFinished = True
if self.rememberShutdown: if self.rememberShutdown:
self.lastShutdown = self.shutdownAfterPrintFinished self.lastShutdown = self.shutdownAfterPrintFinished
self._settings.set_boolean("lastShutdown",self.lastShutdown)
elif command == "disableShutdownAfterFinish": elif command == "disableShutdownAfterFinish":
self._logger.info("disableShutdownAfterFinish") self._logger.info("disableShutdownAfterFinish")
self.shutdownAfterPrintFinished = False self.shutdownAfterPrintFinished = False
if self.rememberShutdown: if self.rememberShutdown:
self.lastShutdown = self.shutdownAfterPrintFinished self.lastShutdown = self.shutdownAfterPrintFinished
self._settings.set_boolean("lastShutdown", self.lastShutdown)
elif command == "enablePowerOffAfterFinish": elif command == "enablePowerOffAfterFinish":
self._logger.info("enablePowerOffAfterFinish") self._logger.info("enablePowerOffAfterFinish")
self.powerOffAfterPrintFinished = True self.powerOffAfterPrintFinished = True
if self.rememberShutdown: if self.rememberShutdown:
self.lastPowerOff = self.powerOffAfterPrintFinished self.lastPowerOff = self.powerOffAfterPrintFinished
self._settings.set_boolean("lastPowerOff", self.lastPowerOff)
elif command == "disablePowerOffAfterFinish": elif command == "disablePowerOffAfterFinish":
self._logger.info("disablePowerOffAfterFinish") self._logger.info("disablePowerOffAfterFinish")
self.powerOffAfterPrintFinished = False self.powerOffAfterPrintFinished = False
if self.rememberShutdown: if self.rememberShutdown:
self.lastPowerOff = self.powerOffAfterPrintFinished self.lastPowerOff = self.powerOffAfterPrintFinished
self._settings.set_boolean("lastPowerOff", self.lastPowerOff)
def get_api_commands(self): def get_api_commands(self):
return dict( return dict(