diff --git a/lib/garage.py b/lib/garage.py index 3c7f1aa..69f78a2 100644 --- a/lib/garage.py +++ b/lib/garage.py @@ -29,12 +29,12 @@ def __init__(self, config): GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.setup(self.relay_pin, GPIO.OUT) + # Set default relay state to false (off) + GPIO.output(self.relay_pin, self.invert_relay) GPIO.setup(self.state_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.add_event_detect(self.state_pin, GPIO.BOTH, callback=self.__stateChanged, bouncetime=300) - # Set default relay state to false (off) - GPIO.output(self.relay_pin, self.invert_relay) # Release rpi resources def __del__(self):