Skip to content

feat: Availability improvements#26811

Merged
Koenkk merged 7 commits intoKoenkk:devfrom
Nerivec:availability-fixes
Apr 13, 2025
Merged

feat: Availability improvements#26811
Koenkk merged 7 commits intoKoenkk:devfrom
Nerivec:availability-fixes

Conversation

@Nerivec
Copy link
Collaborator

@Nerivec Nerivec commented Mar 20, 2025

Important

A router failing to ping likely means a route in the network is lost, which can seriously affect the stability of the network if it happens on a regular basis (delays, missing state updates, other devices temporary unavailable, etc.).

Changes

  • Add jitter to timeout to spread pinging a bit
    • Should prevent storming networks with successive pings
  • Add backoff to timeout to prevent pinging devices as often when they previously failed
    • Backoff calc: *1.5 if device was previously available, *2 otherwise
      • resulting in: *1.5, *3, *6, *12... (with default timeout of 10min: 10, 15, 30, 60, 120)
    • Add ability to pause pinging after backoff reaches a certain value (resumed on next "last seen" update) - this is disabled by default (0) to not change the default Availability behavior too much
  • Widen the definition of "active" to all power sources not unknown/battery to support devices possibly using 3-phase, DC & other more specific sources
  • Cleanup various getters, use Map/Set instead of objects, and some more little fixes

Changes in Availability behavior

  • Three new settings:
    • availability.active.max_jitter (default: 30000)
    • availability.active.backoff (default: true)
    • availability.active.pause_on_backoff_gt (default: 0)
  • Pinging is now randomly offset from timeout by up to max_jitter
  • Backoff is now enabled by default, successive failed pings will increase interval between tries automatically

Should alleviate some of the issues described in #23910 (and others)

TODO:

@Nerivec Nerivec force-pushed the availability-fixes branch 4 times, most recently from 82321b7 to 515488d Compare March 25, 2025 18:35
@Nerivec Nerivec force-pushed the availability-fixes branch 4 times, most recently from c9e3922 to f121eab Compare April 4, 2025 20:41
@Nerivec Nerivec force-pushed the availability-fixes branch from f121eab to 0200ada Compare April 9, 2025 15:09
Nerivec added a commit to Nerivec/zigbee2mqtt.io that referenced this pull request Apr 9, 2025
@Nerivec Nerivec marked this pull request as ready for review April 9, 2025 17:35
@Nerivec Nerivec force-pushed the availability-fixes branch from caafe89 to d07b7c9 Compare April 11, 2025 14:38
@Nerivec Nerivec force-pushed the availability-fixes branch from d07b7c9 to fdd5c76 Compare April 12, 2025 17:12
@Koenkk Koenkk merged commit 8df5a48 into Koenkk:dev Apr 13, 2025
11 checks passed
Koenkk added a commit to Koenkk/zigbee2mqtt.io that referenced this pull request Apr 13, 2025
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
@Nerivec Nerivec deleted the availability-fixes branch April 13, 2025 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants