Central to the system's ability to operate autonomously when needed while preferring manual control when available is the heartbeat mechanism. This solution to the mode-switching problem has been introduced to enhance both reliability and usability.
The heartbeat mechanism governs mode selection between remote and autonomous operation. AR1 embeds an HB:1 field in each STAT frame transmitted over RS-485, every five seconds; its absence for five minutes triggers autonomous mode on AR3. The operator can deliberately enter autonomous mode at any time via a dashboard switch that halts heartbeat transmission while MQTT remains fully connected, and can restore manual control by re-enabling it. If AR1 loses its MQTT connection for more than five minutes, heartbeat transmission ceases automatically, producing the same result. And at Fairhaven, if the internet itself has been down for five minutes, a Home Assistant automation switches the heartbeat off in the same way - so a loss of communications leads to Autonomous mode in about ten minutes either way. In either case the Autonomous Mode Status Panel in the Home Assistant remote dashboard panels, continues to report the current phase, mode, and relay states from AR3's telemetry, and dashboard control can be resumed once communications recover.
AR3 categorises heartbeat health into three states: fresh (received within four seconds), warning (absent for 60 seconds — logged and flagged on the FireSys LCD), and failed (absent for 300 seconds — autonomous mode entered). Return to remote mode requires the heartbeat to be present and steady for 15 seconds, preventing oscillation if the link is unstable; in practice control returns about 15-20 seconds after Autonomous Mode is switched off.
Ways into Autonomous mode
- The Autonomous Mode switch on the dashboard is turned on: AR1 stops the heartbeat, and after a five-minute countdown AR3 takes over.
- The internet fails (Fairhaven): after five minutes without the internet, Home Assistant turns the heartbeat off; AR3 takes over five minutes later. When the internet returns the system deliberately stays in Autonomous mode, and Home Assistant sends an email and SMS saying so; switch Autonomous Mode off when ready to take over.
- AR1 loses Home Assistant (the Pi or the house WiFi fails while the internet is fine): after five minutes AR1 stops the heartbeat; AR3 takes over five minutes later.
- AR1, the house power or the cable fails: the heartbeat simply stops arriving, and AR3 takes over after five minutes.
- The test button in Module 4 is held for three seconds: AR3 takes control at once and sends HB:0 to AR1, so the dashboard's Autonomous Mode switch turns on by itself (see Test scenarios). After a test AR3 stays in Autonomous mode until the switch is turned off - deliberately, so that AR3 never hands control back on its own.
Returning to remote control
When Autonomous Mode is switched off and the heartbeat resumes, AR1 starts manual control from a clean, safe state: the pump, the sprinkler cycle (P1), high flow (P3) and gel (P4) are all switched off, while the operator's shed cooling setting is kept. If Autonomous mode had the pump running and it is still needed, the operator turns it back on from the dashboard.
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. When the MQTT connection returns, AR1 resumes the heartbeat by itself, and control comes back to the dashboard - provided the system was in remote mode when the link was lost. 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.
Restarts keep the mode
Each Arduino remembers its mode in memory (EEPROM) that survives a restart or power cut. AR1 comes back in the mode it was in, and AR3, if it was in Autonomous mode, resumes it at once - at the same fallback stage and with the same tank-level estimate - so a restart costs no autonomous control (see The Electronic Control Sub-System).
Seeing what is happening
In either mode the Autonomous Mode State dashboard panel reports whether Autonomous mode is on and why, the current phase, mode and relay states from AR3's telemetry, and the fallback stage if the temperature sensors have failed. The shed LCD shows the heartbeat state and a "HB:WARN" notice if the heartbeat has been missing for between one and five minutes. What AR3 does once in control is described in Autonomous Fire Defence Algorithms.
Last checked against the code: 7 November 2026.
<< Communication protocols | | Autonomous Fire Defence Algorithms >> |Table of Contents>
