feat: turn off power devices that are associated to the turn on button when shutting down printer
This commit is contained in:
@@ -79,4 +79,12 @@ class Panel(ScreenPanel):
|
||||
if method == "reboot":
|
||||
self._screen._ws.send_method("machine.reboot")
|
||||
else:
|
||||
self.turn_off_power_devices()
|
||||
self._screen._ws.send_method("machine.shutdown")
|
||||
|
||||
def turn_off_power_devices(self):
|
||||
if self.ks_printer_cfg is not None and self._screen._ws.connected:
|
||||
power_devices = self.ks_printer_cfg.get("power_devices", "")
|
||||
if power_devices and self._printer.get_power_devices():
|
||||
logging.info(f"Turning off associated power devices: {power_devices}")
|
||||
self._screen.power_devices(widget=None, devices=power_devices, on=False)
|
||||
|
Reference in New Issue
Block a user