#21 Add PowerOFF when print is finished

This commit is contained in:
David Zingg 2020-06-28 14:48:32 +02:00
parent 01a63ab835
commit 96280e4a4b
3 changed files with 16 additions and 14 deletions

View File

@ -2,6 +2,8 @@
<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/templates/mystromswitch_sidebar.jinja2" beforeDir="false" afterPath="$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_sidebar.jinja2" afterDir="false" /> <change beforePath="$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_sidebar.jinja2" beforeDir="false" afterPath="$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_sidebar.jinja2" afterDir="false" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@ -47,13 +49,6 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1574193087583</updated> <updated>1574193087583</updated>
</task> </task>
<task id="LOCAL-00027" summary="#8 Relais ein / ausschalten von Ocotprint aus&#10;&#10;- Button Style auf default geändert&#10;- get_api_commands implementiert">
<created>1574605785309</created>
<option name="number" value="00027" />
<option name="presentableId" value="LOCAL-00027" />
<option name="project" value="LOCAL" />
<updated>1574605785309</updated>
</task>
<task id="LOCAL-00028" summary="#8 Relais ein / ausschalten von Ocotprint aus&#10;&#10;- url korrigiert"> <task id="LOCAL-00028" summary="#8 Relais ein / ausschalten von Ocotprint aus&#10;&#10;- url korrigiert">
<created>1574606064523</created> <created>1574606064523</created>
<option name="number" value="00028" /> <option name="number" value="00028" />
@ -390,7 +385,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1593347943336</updated> <updated>1593347943336</updated>
</task> </task>
<option name="localTasksCounter" value="76" /> <task id="LOCAL-00076" summary="#21 Add PowerOFF when print is finished">
<created>1593348030528</created>
<option name="number" value="00076" />
<option name="presentableId" value="LOCAL-00076" />
<option name="project" value="LOCAL" />
<updated>1593348030528</updated>
</task>
<option name="localTasksCounter" value="77" />
<servers /> <servers />
</component> </component>
<component name="UnknownFeatures"> <component name="UnknownFeatures">

View File

@ -276,10 +276,10 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
def on_event(self, event, payload): def on_event(self, event, payload):
if event == Events.CLIENT_OPENED: if event == Events.CLIENT_OPENED:
self._plugin_manager.send_plugin_message(self._identifier, #self._plugin_manager.send_plugin_message(self._identifier,
dict(automaticShutdownEnabled=self.shutdownAfterPrintFinished)) # dict(automaticShutdownEnabled=self.shutdownAfterPrintFinished))
self._plugin_manager.send_plugin_message(self._identifier, #self._plugin_manager.send_plugin_message(self._identifier,
dict(automaticPowerOffEnabled=self.powerOffAfterPrintFinished)) # dict(automaticPowerOffEnabled=self.powerOffAfterPrintFinished))
return return
if not self.shutdownAfterPrintFinished and not self.powerOffAfterPrintFinished: if not self.shutdownAfterPrintFinished and not self.powerOffAfterPrintFinished:

View File

@ -3,12 +3,12 @@
<label class="control-label" id="mystromswitchEnergyValue">Energy 0.0Wh</label> <label class="control-label" id="mystromswitchEnergyValue">Energy 0.0Wh</label>
<button class="btn btn-primary" data-bind="click: onToggleRelayEvent, visible : onOffButtonEnabled">{{ _('Toggle Relais') }}</button> <button class="btn btn-primary" data-bind="click: onToggleRelayEvent, visible : onOffButtonEnabled">{{ _('Toggle Relais') }}</button>
<label class="checkbox"> <label class="checkbox">
<input type="checkbox" data-bind="enable: loginState.isUser(), change: automaticShutdownEnabled, visible :showShutdownOctopiOption"/> <input type="checkbox" data-bind="enable: loginState.isUser(), change: automaticShutdownEnabled, visible :showShutdownOctopiOption">
{{ _('Shutdown Octoprint after print finishes') }} {{ _('Shutdown Octoprint after print finishes') }}
</label> </label>
<label class="checkbox"> <label class="checkbox">
<input type="checkbox" data-bind="enable: loginState.isUser(), change: automaticPowerOffEnabled, visible: showPowerOffPrintFinishOption"/> <input type="checkbox" data-bind="enable: loginState.isUser(), change: automaticPowerOffEnabled, visible: showPowerOffPrintFinishOption">
{{ _('Power Off Relais after print finishes') }} {{ _('Power Off Relais after print finishes') }}
</label> </label>
</div> </div>