The transition from autonomous back to remote mode requires some sophistication in its handling of state synchronization. Rather than immediately imposing Home Assistant's commanded states, which might differ significantly from what autonomous mode had established, AR1 implements a state adoption mechanism. During the period when heartbeat transmission resumes but before AR1 begins issuing new commands, AR3 continues publishing its current state in telemetry frames every two seconds. AR1 captures the most recent telemetry, extracting the pump state, all four peripheral valve positions, and the water level. It then applies these values to its local state variables and publishes them to MQTT as retained messages, ensuring that Home Assistant's dashboard reflects the actual current system state rather than stale historical values.
This adoption process prevents several problematic scenarios. An example is provided by the case where autonomous mode has activated the pump in response to high external temperature, but the Home Assistant dashboard still shows the pump as off because that was its state when communications failed. Without state adoption, the transition to remote mode would immediately send a pump-off command based on the dashboard state, potentially shutting down active fire defence at a critical moment. With state adoption, AR1 first updates the dashboard to show pump-on, then begins accepting new operator commands from that synchronized starting point.
The heartbeat system also responds to MQTT failures at the AR1 level. If AR1 loses connection to the Home Assistant MQTT broker for more than five minutes, it recognizes that manual control is no longer viable even though AR1 itself remains functional. In this case, AR1 stops transmitting heartbeats over RS-485, deliberately triggering autonomous mode on AR3. The operator loses dashboard visibility and control, but the fire defence system continues operating based on sensor inputs rather than becoming completely non-responsive. This ensures that communication failures anywhere in the chain from operator to pump result in autonomous operation rather than a potentially dangerous lack of response.
<< | | >> |Table of Contents>
