Repository navigation
fix: mark a device offline on a majority of distinct stale bridges, not on every bridge - #42
Merged
baudneo merged 2 commits intoOct 25, 2026
Conversation
A bulb that is itself a TCP bridge and loses power can stay "on" in HA: the mesh flags it stale ~26 s after the cut, but if its dead bridge session is reaped after the other bridges' stale reports arrive, `num_late_states >= len(pool)` was evaluated against the old, larger pool and never re-checked. CyncTCPSession.close() now calls nCyncServer.revote_offline(), which re-runs the vote for every device that has outstanding stale reports against the new pool size. Counted in the offline_revotes stat. Refs baudneo#39 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ot on every bridge Hardware run 2026-10-23 (8 live bridges, 4-bulb fixture cut at the wall): all 8 bridges reported two of the bulbs stale, but only 7 reported the other two. The vote needed `stale reports >= len(pool)`, so those two stayed "on" in HA indefinitely. Each bridge only reports the devices it has heard from, so "every bridge" is not a reachable condition. - Track the distinct bridge IPs that reported a device stale since its last valid report (`stale_voters`) instead of counting reports; repeat reports from one bridge no longer count twice. - A device goes offline when a strict majority of the live bridges have voted (a lone bridge decides alone). Votes from disconnected bridges are ignored. - Handler passes the reporting bridge's IP to handle_entity_update (0x83 internal status). Refs baudneo#39 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Oct 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 2/4 of the split requested in #39 (comment). Depends on #41 (only new commit here is
14c7c13).Some bridges (in my case, an always-on Cync plug) never report status for every device on the mesh, so requiring all live bridges to report a device stale means the vote can never be reached. Switches the threshold to a strict majority of distinct live bridges instead of unanimous.