Today, if the MQTT broker restarts, the client connection drops or even if there's an exception (i.e. "GarbageInput") during arming/disarming over MQTT - no reconnection attempt is made and the application is effectively dead.
This addresses these issues by:
Moving registration/LWT declaration to on_connect
Implementing on_disconnect which calls connect
Logging exceptions when handling MQTT messages rather than propagating them
In addition, adds some basic debug logs.
Tested by:
Restarting MQTT broker
Forcing pima_server off the network and then adding it back
Still observing long term effects of this, but happy for feedback in the interim.
Today, if the MQTT broker restarts, the client connection drops or even if there's an exception (i.e. "GarbageInput") during arming/disarming over MQTT - no reconnection attempt is made and the application is effectively dead.
This addresses these issues by:
In addition, adds some basic debug logs.
Tested by:
Still observing long term effects of this, but happy for feedback in the interim.