From 9caca9074a3801a5de6e5b9b35ab0650e4643e5a Mon Sep 17 00:00:00 2001 From: avollkopf <43980694+avollkopf@users.noreply.github.com> Date: Sun, 7 Feb 2021 12:07:48 +0100 Subject: [PATCH] Change Inverted logic for GPIO Actor If sensor is set to active, GPIO pin should be high under normal conditions. If inverted, GPIO pin should be low when sensor is active. This logic is aligned with the old craftbeerpi3 GPIOSystem plugin --- cbpi/extension/gpioactor/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cbpi/extension/gpioactor/__init__.py b/cbpi/extension/gpioactor/__init__.py index 50a15ae..ae8104f 100644 --- a/cbpi/extension/gpioactor/__init__.py +++ b/cbpi/extension/gpioactor/__init__.py @@ -20,17 +20,17 @@ except Exception: import RPi.GPIO as GPIO -@parameters([Property.Select(label="GPIO", options=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]), Property.Select(label="Inverted", options=["Yes", "No"])]) +@parameters([Property.Select(label="GPIO", options=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]), Property.Select(label="Inverted", options=["Yes", "No"],description="No: Active on high; Yes: Active on low")]) class GPIOActor(CBPiActor): def get_GPIO_state(self, state): # ON if state == 1: - return 0 if self.inverted == False else 1 + return 1 if self.inverted == False else 0 # OFF if state == 0: - return 1 if self.inverted == False else 0 + return 0 if self.inverted == False else 1 async def start(self): await super().start()