Repository navigation
Ignore unavailable members when computing fan and switch group state - #911
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #911 +/- ##
=======================================
Coverage 97.22% 97.22%
=======================================
Files 61 61
Lines 10654 10655 +1
=======================================
+ Hits 10358 10359 +1
Misses 296 296 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
TheJulianJES
approved these changes
Sep 29, 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.
Follow-up to #888, which stops an unavailable member from keeping a light group on. The other two group entities,
FanGroupandSwitchGroup, derive their state from member states the same way and have the same problem: an unavailable member keeps reporting its last known state, so it still feeds into the group state.SwitchGroup.update(): an unavailable member that was on kept the group on. Now only available members count towards the on state, same as Ignore unavailable members when computing light group state #888 does for lights.FanGroup.update(): the group takes the percentage (or preset mode) of the first member that has one, so an unavailable member's stale speed could win over the reachable members, or keep the group on after every reachable member was turned off. Unavailable members are now skipped when picking the percentage/preset mode.Neither group merges any capabilities from its members (unlike
LightGroup, which merges supported color modes, effect lists, and mired ranges over all members), so there is nothing to keep merged over unavailable members here.LightGroupitself is left to #888.Tests: added
test_group_state_ignores_unavailable_memberstotests/test_fan.pyandtests/test_switch.py, modelled on the light test from #888. Both fail ondevand pass with this change. They take the member offline withupdate_available(False)/update_available(True), the path the availability checker uses.Side note, not fixed here: setting
on_network = Trueon a fan or switch member doesn't emit a state change for its entity (the setter callsupdate_available()before flipping_on_network, and their re-init finishes without suspending), which is why the tests don't use it like the light test does.