#21 Only check shutdown command defined if Raspberry Pi needs to shutdown

This commit is contained in:
David Zingg
2020-08-29 16:44:46 +02:00
parent 96fdafb2dc
commit 9afe94169d
2 changed files with 20 additions and 19 deletions

View File

@ -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