#21 Add PowerOFF when print is finished

This commit is contained in:
David Zingg 2020-06-28 15:58:29 +02:00
parent a3e770158c
commit 8ea9f65048
2 changed files with 23 additions and 9 deletions

View File

@ -4,7 +4,6 @@
<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$/.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" />
<change beforePath="$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_settings.jinja2" beforeDir="false" afterPath="$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_settings.jinja2" afterDir="false" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
@ -49,13 +48,6 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1574193087583</updated> <updated>1574193087583</updated>
</task> </task>
<task id="LOCAL-00031" summary="#8 Relais ein / ausschalten von Ocotprint aus&#10;&#10;- Toggle Button enable / disable in Einstellunge&#10;- Databinding von Button">
<created>1574607577396</created>
<option name="number" value="00031" />
<option name="presentableId" value="LOCAL-00031" />
<option name="project" value="LOCAL" />
<updated>1574607577396</updated>
</task>
<task id="LOCAL-00032" summary="#8 Relais ein / ausschalten von Ocotprint aus"> <task id="LOCAL-00032" summary="#8 Relais ein / ausschalten von Ocotprint aus">
<created>1574607723126</created> <created>1574607723126</created>
<option name="number" value="00032" /> <option name="number" value="00032" />
@ -392,7 +384,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1593350619006</updated> <updated>1593350619006</updated>
</task> </task>
<option name="localTasksCounter" value="80" /> <task id="LOCAL-00080" summary="#21 Add PowerOFF when print is finished">
<created>1593352569980</created>
<option name="number" value="00080" />
<option name="presentableId" value="LOCAL-00080" />
<option name="project" value="LOCAL" />
<updated>1593352569980</updated>
</task>
<option name="localTasksCounter" value="81" />
<servers /> <servers />
</component> </component>
<component name="UnknownFeatures"> <component name="UnknownFeatures">

View File

@ -94,6 +94,21 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
self._abort_timer = RepeatedTimer(1, self._shutdown_timer_task) self._abort_timer = RepeatedTimer(1, self._shutdown_timer_task)
self._abort_timer.start() self._abort_timer.start()
def _wait_for_timelapse_start(self):
if self._wait_for_timelapse_timer is not None:
return
self._wait_for_timelapse_timer = RepeatedTimer(5, self._wait_for_timelapse)
self._wait_for_timelapse_timer.start()
def _wait_for_timelapse(self):
c = len(octoprint.timelapse.get_unrendered_timelapses())
if c > 0:
self._logger.info("Waiting for %s timelapse(s) to finish rendering before starting shutdown timer..." % c)
else:
self._shutdown_timer_start()
def _shutdown_timer_task(self): def _shutdown_timer_task(self):
if self._timeout_value is None: if self._timeout_value is None:
return return