marthoc / GarHAge

a Home-Automation-friendly ESP8266-based MQTT Garage Door Controller
MIT License
170 stars 42 forks source link

Fix bug causing double-publishing of door status #19

Closed marthoc closed 6 years ago

marthoc commented 6 years ago

Some users reported that GarHAge would send duplicate door status messages (i.e. two "open" or "closed" messages in a row). This PR ensures that GarHAge only publishes the message that correctly corresponds to the state the door has changed to. Renamed the debounceTime parameter to deadTime to more accurately reflect its use and increased it to 4000 to ensure that the door/reed switch will have settled in its final position before we try to read the status again for publishing purposes. Closes #16.