#21 Add PowerOFF when print is finished
This commit is contained in:
@ -202,6 +202,12 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
|
||||
elif command == "disablePowerOffAfterFinish":
|
||||
self._logger.info("disablePowerOffAfterFinish")
|
||||
self.powerOffAfterPrintFinished = False
|
||||
self._plugin_manager.send_plugin_message(self._identifier,
|
||||
dict(showShutdownOctopiOption=self.shutdownAfterPrintFinished,
|
||||
type="timeout", timeout_value=self._timeout_value))
|
||||
self._plugin_manager.send_plugin_message(self._identifier,
|
||||
dict(showPowerOffPrintFinishOption=self.powerOffAfterPrintFinished,
|
||||
type="timeout", timeout_value=self._timeout_value))
|
||||
|
||||
def get_api_commands(self):
|
||||
return dict(
|
||||
@ -270,6 +276,15 @@ 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(showShutdownOctopiOption=self.shutdownAfterPrintFinished,
|
||||
type="timeout", timeout_value=self._timeout_value))
|
||||
self._plugin_manager.send_plugin_message(self._identifier,
|
||||
dict(showPowerOffPrintFinishOption=self.powerOffAfterPrintFinished,
|
||||
type="timeout", timeout_value=self._timeout_value))
|
||||
return
|
||||
|
||||
if not self.shutdownAfterPrintFinished and not self.powerOffAfterPrintFinished:
|
||||
return
|
||||
|
||||
|
@ -62,8 +62,8 @@ $(function() {
|
||||
})
|
||||
}
|
||||
|
||||
//self.automaticShutdownEnabled.subscribe(self.onAutomaticShutdownEnabledChanged,self);
|
||||
//self.automaticPowerOffEnabled.subscribe(self.onAutomaticPowerOffEnabledChanged,self);
|
||||
self.automaticShutdownEnabled.subscribe(self.onAutomaticShutdownEnabledChanged,self);
|
||||
self.automaticPowerOffEnabled.subscribe(self.onAutomaticPowerOffEnabledChanged,self);
|
||||
|
||||
self.onDataUpdaterPluginMessage = function(plugin, data) {
|
||||
if (plugin != "mystromswitch" && plugin != "octoprint_mystromswitch") {
|
||||
|
Reference in New Issue
Block a user