From 76ccc8b3e14d1186cb1b25f3e0356d2829444a71 Mon Sep 17 00:00:00 2001 From: Arksine Date: Fri, 25 Dec 2020 19:31:03 -0500 Subject: [PATCH] power: Add 'initial_state' option for GPIO devices Signed-off-by: Eric Callahan --- moonraker/plugins/power.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/moonraker/plugins/power.py b/moonraker/plugins/power.py index 75bcd22..3f887a8 100644 --- a/moonraker/plugins/power.py +++ b/moonraker/plugins/power.py @@ -164,7 +164,8 @@ class GpioDevice: f"Unable to init {pin}. Make sure the gpio is not in " "use by another program or exported by sysfs.") raise config.error("Power GPIO Config Error") - self.set_power("off") + initial_state = config.getboolean('initial_state', False) + self.set_power("on" if initial_state else "off") def _parse_pin(self, config): pin = cfg_pin = config.get("pin")