I have a garage door based on a ESP8266 that runs a REST API for operation. I have a hardware button and an app that use these APIs. In addition, I have written a device handler that uses these APIs.
As long as the garage door is controlled from SmartThings, SmartThings knows what the device’s state is aka whether or not it is open or closed. If I use the hardware button or other app then it gets out of sync.
In the device handler I implemented the refresh functionality so I can get it back into sync but that is a manual action the user has to perform. If there are automations based on the door they wouldn’t fire until the user updated the state manually.
I have found that I can schedule events or run events every X minutes with the runEveryXMinutes (or hours) functions. Is this the best way to solve this problem?
I have control over the firmware but I would really rather not make changes to it since I have never been able to get the creator’s project to compile because of old library dependencies.
Please let me know what is best practice to keep state in synchronization when changing the device firmware is not a possible, feasible, etc.
Also, if I use runEvery1Minute to schedule something will it automatically remove the previous schedule when updating the handler code or how does that work? There is no documentation about that here.
Thanks in advance!