diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index f0c0283..ea840e1 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -3,7 +3,8 @@
-
+
+
@@ -11,92 +12,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- onOffBu
- onmystromswitchEvent
- showShutdownOctopiOption
- onToggleRelayEvent
- onOffButtonEnabled
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -544,29 +395,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -586,12 +414,6 @@
-
-
-
-
-
-
@@ -599,9 +421,6 @@
-
-
-
@@ -630,47 +449,4 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/octoprint_mystromswitch/__init__.py b/octoprint_mystromswitch/__init__.py
index 7afb0e8..1715efb 100644
--- a/octoprint_mystromswitch/__init__.py
+++ b/octoprint_mystromswitch/__init__.py
@@ -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
diff --git a/octoprint_mystromswitch/static/js/mystromswitch.js b/octoprint_mystromswitch/static/js/mystromswitch.js
index 99e2896..e512045 100644
--- a/octoprint_mystromswitch/static/js/mystromswitch.js
+++ b/octoprint_mystromswitch/static/js/mystromswitch.js
@@ -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") {