diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 183db3a..ee7e3e4 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,6 +3,7 @@ + diff --git a/octoprint_mystromswitch/__init__.py b/octoprint_mystromswitch/__init__.py index 52564d3..d7f7db5 100644 --- a/octoprint_mystromswitch/__init__.py +++ b/octoprint_mystromswitch/__init__.py @@ -162,6 +162,10 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin, self._status_timer.start() def _shutdown_system(self): + if not self._settings.global_get(["server", "commands", "systemShutdownCommand"]): + self._logger.warning("systemShutdownCommand is not defined. Aborting shutdown...") + return + self._logger.info("Shutdown Relais and System") self._powerCycleRelais(False, self.powerOffDelay) shutdown_command = self._settings.global_get(["server", "commands", "systemShutdownCommand"]) @@ -390,10 +394,6 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin, if not self.shutdownAfterPrintFinished and not self.powerOffAfterPrintFinished: return - if not self._settings.global_get(["server", "commands", "systemShutdownCommand"]): - self._logger.warning("systemShutdownCommand is not defined. Aborting shutdown...") - return - if event not in [Events.PRINT_DONE, Events.PRINT_FAILED]: return