Initialize state correctly
This commit is contained in:
parent
2118ab0d6a
commit
5fc8b04986
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue