diff --git a/garage.py b/garage.py index 754f09b..ed56df9 100644 --- a/garage.py +++ b/garage.py @@ -22,11 +22,14 @@ topic = config['push'].get('topic') def main(): - persistState() - eastButton = Button(eastPin) westButton = Button(westPin) + state['east-door'] = 'closed' if eastButton.is_pressed else 'open' + state['west-door'] = 'closed' if westButton.is_pressed else 'open' + + persistState() + eastButton.when_pressed = eastDoorClosed eastButton.when_released = eastDoorOpened westButton.when_pressed = westDoorClosed