#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

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

View File

@ -3,12 +3,12 @@
<label class="control-label" id="mystromswitchEnergyValue">Energy 0.0Wh</label>
<button class="btn btn-primary" data-bind="click: onToggleRelayEvent, visible : onOffButtonEnabled">{{ _('Toggle Relais') }}</button>
<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') }}
</label>
<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') }}
</label>
</div>