marthoc / GarHAge

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

Add door status check before executing OPEN or CLOSE action #6

Closed marthoc closed 6 years ago

marthoc commented 6 years ago

Previously, when receiving an OPEN or CLOSE payload on an action topic, GarHAge would take that action regardless of the current state of the door. This PR changes that behaviour, so that GarHAge will now check whether the requested action (OPEN or CLOSE) is different from the current state of the door before taking action, and will not take action if the requested action matches the current state. This change makes it important that users configure their clients to send both OPEN and CLOSE payloads since it will break functionality otherwise!

Example:

marthoc commented 6 years ago

Added code to provide that if a sanityCheck function fails (i.e. the requested action and the current state are equal) a status update is also triggered.