The final thing we need to do before our controller is ready, is to add a mechanism to recover from stale states. There are many reasons why a controller might end up in a stale state. A stale state is defined as a state that does not correspond to reality. There might be network problems for the controller, or any of the devices it depends on. The devices might be broken, replaced, or simply restarted. To build in some form of resilience into our controller, we need to monitor that we get sensor data in a timely fashion and that we can perform control actions properly.
There are basically three things we need to monitor:
- That we receive subscription events properly
- That the device connections are still valid ...