The code posted above fixes this issue.
If your interested in a version with this incorporated you can find my fork here
It also adds MQTT and integrated automation to close the door at a certain time (my normal use case when I leave it at night)
Lots of other misc changes. I tried to mimic the coding style and conventions if any of it wants to be incorporated back in.