I am trying to write a controller for my garage door and have run into a problem. To close the door I need to keep the relay switched on until the reed switch closes. To do this I have set up a lambda under the ‘close_action’ case in the esphome garage cover.
The lambda attempts to say:
- If the door is not closed, then set the door_state to ‘closing’ and flip the relay on
- While the door is closing, keep checking the closed_sensor state. If it flips to true, the door is closed. Set the door_state to closed and flip the relay back off
The first clause seems to work correctly, but when we get into the while loop it either freezes after around 10 loops, or freezes when I close the reed switch. I have to unplug the Sonoff to reset everything and try again.
yaml for esphome:
log output from esphome:
https://pastebin.com/SK6Re0wH]
I have absolutely no idea why this is happening and would really appreciate some help! I am also wide open to other solutions if there is a better way.