From 778821e5e5a17ca125556c0f2ebb640776acfc0a Mon Sep 17 00:00:00 2001 From: David Zingg Date: Wed, 1 Jul 2020 20:51:31 +0200 Subject: [PATCH] #21 Add PowerOFF when print is finished --- .idea/workspace.xml | 17 ++++++++--------- octoprint_mystromswitch/__init__.py | 4 ++++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 538a542..17a3d4c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,7 +2,6 @@ - diff --git a/octoprint_mystromswitch/__init__.py b/octoprint_mystromswitch/__init__.py index b5df220..2329f35 100644 --- a/octoprint_mystromswitch/__init__.py +++ b/octoprint_mystromswitch/__init__.py @@ -280,6 +280,7 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin, if self.rememberShutdown: self.lastShutdown = self.shutdownAfterPrintFinished self._settings.set_boolean(["lastShutdown"], self.lastShutdown) + self._settings.save() self._logger.info("lastShutdown: %s" % self.lastShutdown) elif command == "disableShutdownAfterFinish": self._logger.info("disableShutdownAfterFinish") @@ -287,6 +288,7 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin, if self.rememberShutdown: self.lastShutdown = self.shutdownAfterPrintFinished self._settings.set_boolean(["lastShutdown"], self.lastShutdown) + self._settings.save() self._logger.info("lastShutdown: %s" % self.lastShutdown) elif command == "enablePowerOffAfterFinish": self._logger.info("enablePowerOffAfterFinish") @@ -294,6 +296,7 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin, if self.rememberShutdown: self.lastPowerOff = self.powerOffAfterPrintFinished self._settings.set_boolean(["lastPowerOff"], self.lastPowerOff) + self._settings.save() self._logger.info("lastPowerOff: %s" % self.lastPowerOff) elif command == "disablePowerOffAfterFinish": self._logger.info("disablePowerOffAfterFinish") @@ -301,6 +304,7 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin, if self.rememberShutdown: self.lastPowerOff = self.powerOffAfterPrintFinished self._settings.set_boolean(["lastPowerOff"], self.lastPowerOff) + self._settings.save() self._logger.info("lastPowerOff: %s" % self.lastPowerOff) def get_api_commands(self):