Governed policy: re-arm a backed-off tracked node when its advert is heard (or a refresh service)
Environment: meshcore-ha 3.0.1 (I checked main / 3.0.3, rearm_heard_node() is unchanged), Home Assistant Core 2026.10.2, companion connected over TCP, traffic policy governed, one tracked repeater (status interval 3600 s, telemetry + neighbours enabled), repeater is a direct neighbour (0 hops, around -60 dBm).
What happens
My repeater was powered off for about 10 hours. The status polls failed, after the third failure the route was reset (expected). From then on every attempt went out as a flood and backoff_delay() doubled the configured interval: 1 h -> 2 h -> 4 h -> ... up to GOVERNED_BACKOFF_CAP_SECONDS (24 h). The schedule is persisted in .storage/meshcore.traffic_<entry_id> and restored after a Core restart, so restarting Home Assistant does not help either (I restarted four times that evening, the stored next_due survived each one).
The repeater came back at 16:35. The next scheduled attempts were 19:43 and 21:52, both logged
WARNING [custom_components.meshcore] Error requesting status from repeater <name>: no response (timeout or send failure)
and the stored schedule then said next_due 01:34 the next day, failures: 2. Meanwhile the companion heard plenty of other nodes, and a manual
meshcore.execute_command command: req_status_sync "<prefix>"
at 22:15 answered immediately with a full status frame and even restored the direct route (out_path_len went from -1 to 0). Until that manual request all repeater entities had been unavailable for six hours although the node was up and reachable.
Why
handle_advertisement() calls rearm_heard_node(), but that only re-arms nodes in _auto_disabled_devices:
def rearm_heard_node(self, public_key: str) -> None:
"""Resume governed polling when an auto-disabled tracked node advertises."""
if self._traffic_policy != POLICY_GOVERNED:
return
for prefix in tuple(self._auto_disabled_devices):
if public_key.startswith(prefix):
self.seed_tracked_node(prefix)
A tracked node that is merely sitting in a backoff (consecutive failures > 0, next_due hours in the future) is not touched when its advert arrives, so the integration keeps waiting out a delay that was computed while the node was down.
Suggestion
- In
rearm_heard_node(), also re-arm a tracked node whose status or telemetrynext_duelies in the future because of a backoff (for example_repeater_consecutive_failures.get(prefix, 0) > 0or_telemetry_consecutive_failures), i.e. callseed_tracked_node(prefix)or at least setnext_due = nowand clear the failure counter. The advert proves the node is reachable again, the poll costs one credit, and it cannot run more often than the configured interval afterwards. - Optionally a service (something like
meshcore.refresh_nodewithpubkey_prefix) that does the same on demand, so an automation can trigger it.
Workaround
An automation that calls execute_command req_status_sync "<prefix>" every 30 minutes while the repeater's Online binary sensor is not on. That refills the sensors and the route, but the Online sensor stays unknown until the coordinator's own backed-off poll finally succeeds, because _last_successful_request is only stamped by _increment_success().
Related but older and from the legacy era: #176. Happy to test a change.
Diagnosis is right, and the writeup saved me the work. rearm_heard_node only walks _auto_disabled_devices (coordinator.py:1245), so a node that is merely backed off with failures > 0 and a next_due hours out is never touched when its advert arrives. The advert proves reachability, which is exactly the signal the backoff was guessing at.
Your option 1 is the right shape. Re-arming on advert for a tracked node with a non-zero failure count, not just an auto-disabled one, and clearing the counter so the next attempt goes out at the configured interval rather than the doubled one.
The detail about the Online sensor staying unknown is a real second bug: _last_successful_request is only stamped in _increment_success(), so a manual req_status_sync refills the entities without ever marking the node heard. Worth fixing in the same change.
Taking it. No date.
Thanks for picking it up! If it helps, I'd be happy to put together a PR for both points (re-arm on advert for tracked nodes with a non-zero failure count and clearing the counter, plus stamping _last_successful_request when a manual req_status_sync returns a status). Otherwise I'll leave it to you.
Yes please, both in one PR. The two spots: rearm_heard_node (coordinator.py:1241) should also seed any tracked node with a non-zero _repeater_consecutive_failures / _telemetry_consecutive_failures and clear the counter, and _last_successful_request needs stamping when a manual req_status_sync returns a status, which today only happens in _increment_success(). A test for each in tests_integration/ and I will take it from there.