Initialize state correctly

This commit is contained in:
Mike Cifelli 2022-12-30 14:16:17 -05:00
parent 2118ab0d6a
commit 5fc8b04986
1 changed files with 5 additions and 2 deletions

View File

@ -22,11 +22,14 @@ topic = config['push'].get('topic')
def main(): def main():
persistState()
eastButton = Button(eastPin) eastButton = Button(eastPin)
westButton = Button(westPin) 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_pressed = eastDoorClosed
eastButton.when_released = eastDoorOpened eastButton.when_released = eastDoorOpened
westButton.when_pressed = westDoorClosed westButton.when_pressed = westDoorClosed