From a3ba4b41690c8ef045df8751a733c703519054a5 Mon Sep 17 00:00:00 2001 From: Pedro Lamas Date: Fri, 12 Nov 2021 00:04:20 +0000 Subject: [PATCH] power: improves GPIO initial_state handling Signed-off-by: Pedro Lamas --- moonraker/components/power.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/moonraker/components/power.py b/moonraker/components/power.py index 71d6ce8..1387df0 100644 --- a/moonraker/components/power.py +++ b/moonraker/components/power.py @@ -478,10 +478,12 @@ class GpioDevice(PowerDevice): if invert: self.line.request( consumer="moonraker", type=gpiod.LINE_REQ_DIR_OUT, - flags=gpiod.LINE_REQ_FLAG_ACTIVE_LOW) + flags=gpiod.LINE_REQ_FLAG_ACTIVE_LOW, + default_val=int(self.initial_state)) else: self.line.request( - consumer="moonraker", type=gpiod.LINE_REQ_DIR_OUT) + consumer="moonraker", type=gpiod.LINE_REQ_DIR_OUT, + default_val=int(self.initial_state)) except Exception: self.state = "error" logging.exception(