#21 Add PowerOFF when print is finished

This commit is contained in:
David Zingg 2020-02-29 16:43:53 +01:00
parent 83608fa807
commit 419bac3137
2 changed files with 8 additions and 4 deletions

View File

@ -120,7 +120,7 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
data = {"relay": True, "energy": 0, "onOffButtonEnabled": False, "showShutdownOctopiOption": False, data = {"relay": True, "energy": 0, "onOffButtonEnabled": False, "showShutdownOctopiOption": False,
"showPowerOffPrintFinishOption": False} "showPowerOffPrintFinishOption": False}
self._plugin_manager.send_plugin_message(self._identifier, data) self._plugin_manager.send_plugin_message(self._identifier, data)
def _setRelaisState(self, newState): def _setRelaisState(self, newState):
nbRetry = 0 nbRetry = 0
value = '0' value = '0'
@ -207,7 +207,11 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
return dict( return dict(
enableRelais=[], enableRelais=[],
disableRelais=[], disableRelais=[],
toggleRelais=[] toggleRelais=[],
disableShutdownAfterFinish=[],
enableShutdownAfterFinish=[],
disablePowerOffAfterFinish=[],
enablePowerOffAfterFinish=[]
) )
def on_after_startup(self): def on_after_startup(self):

View File

@ -30,7 +30,7 @@ $(function() {
//self.onOffButtonEnabled.subscribe(self.onmystromswitchEvent, self); //self.onOffButtonEnabled.subscribe(self.onmystromswitchEvent, self);
self.onAutomaticShutdownEnabledChanged = function(){ /*self.onAutomaticShutdownEnabledChanged = function(){
var cmd = "disableShutdownAfterFinish"; var cmd = "disableShutdownAfterFinish";
if (self.automaticShutdownEnabled()) { if (self.automaticShutdownEnabled()) {
var cmd = "enableShutdownAfterFinish"; var cmd = "enableShutdownAfterFinish";
@ -60,7 +60,7 @@ $(function() {
}), }),
contentType: "application/json; charset=UTF-8" contentType: "application/json; charset=UTF-8"
}) })
} }*/
//self.automaticShutdownEnabled.subscribe(self.onAutomaticShutdownEnabledChanged,self); //self.automaticShutdownEnabled.subscribe(self.onAutomaticShutdownEnabledChanged,self);
//self.automaticPowerOffEnabled.subscribe(self.onAutomaticPowerOffEnabledChanged,self); //self.automaticPowerOffEnabled.subscribe(self.onAutomaticPowerOffEnabledChanged,self);