From 0b3b8cede8ca5e93d7d3cf23909e966f46c6fe5a Mon Sep 17 00:00:00 2001 From: Jordan Ruthe Date: Fri, 22 Jan 2021 09:42:09 -0500 Subject: [PATCH] power: Raise error if trying to change a locked device during printing Signed-off-by: Jordan Ruthe --- moonraker/plugins/power.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/moonraker/plugins/power.py b/moonraker/plugins/power.py index daa23d5..82ff6ec 100644 --- a/moonraker/plugins/power.py +++ b/moonraker/plugins/power.py @@ -105,13 +105,9 @@ class PrinterPower: async def _process_request(self, device, req): if req in ["on", "off"]: printing = await self._check_klippy_printing() - logging.info("Device locked: %s" % device.get_locked_while_printing()) - logging.info("Klippy printing: %s" % printing) if device.get_locked_while_printing() and printing: - self.server.error(f"Unable to change power for {device} " + - "while printing") - dev_info = device.get_device_info() - return dev_info['status'] + raise self.server.error(f"Unable to change power for {device} " + + "while printing") ret = device.set_power(req) if asyncio.iscoroutine(ret): await ret