From 419bac31370db537a968bb2dfc252c6bf437dc0c Mon Sep 17 00:00:00 2001 From: David Zingg Date: Sat, 29 Feb 2020 16:43:53 +0100 Subject: [PATCH] #21 Add PowerOFF when print is finished --- octoprint_mystromswitch/__init__.py | 8 ++++++-- octoprint_mystromswitch/static/js/mystromswitch.js | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/octoprint_mystromswitch/__init__.py b/octoprint_mystromswitch/__init__.py index abbd4d7..7afb0e8 100644 --- a/octoprint_mystromswitch/__init__.py +++ b/octoprint_mystromswitch/__init__.py @@ -120,7 +120,7 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin, data = {"relay": True, "energy": 0, "onOffButtonEnabled": False, "showShutdownOctopiOption": False, "showPowerOffPrintFinishOption": False} self._plugin_manager.send_plugin_message(self._identifier, data) - + def _setRelaisState(self, newState): nbRetry = 0 value = '0' @@ -207,7 +207,11 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin, return dict( enableRelais=[], disableRelais=[], - toggleRelais=[] + toggleRelais=[], + disableShutdownAfterFinish=[], + enableShutdownAfterFinish=[], + disablePowerOffAfterFinish=[], + enablePowerOffAfterFinish=[] ) def on_after_startup(self): diff --git a/octoprint_mystromswitch/static/js/mystromswitch.js b/octoprint_mystromswitch/static/js/mystromswitch.js index 3f98a87..8d0c978 100644 --- a/octoprint_mystromswitch/static/js/mystromswitch.js +++ b/octoprint_mystromswitch/static/js/mystromswitch.js @@ -30,7 +30,7 @@ $(function() { //self.onOffButtonEnabled.subscribe(self.onmystromswitchEvent, self); - self.onAutomaticShutdownEnabledChanged = function(){ + /*self.onAutomaticShutdownEnabledChanged = function(){ var cmd = "disableShutdownAfterFinish"; if (self.automaticShutdownEnabled()) { var cmd = "enableShutdownAfterFinish"; @@ -60,7 +60,7 @@ $(function() { }), contentType: "application/json; charset=UTF-8" }) - } + }*/ //self.automaticShutdownEnabled.subscribe(self.onAutomaticShutdownEnabledChanged,self); //self.automaticPowerOffEnabled.subscribe(self.onAutomaticPowerOffEnabledChanged,self);