-
-
Notifications
You must be signed in to change notification settings - Fork 28.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return specific group state if there is one #115866
Conversation
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
It seems like most cases will be a single active domain. Suggestion to optimize for that bdraco@34d4f95 |
@@ -60,11 +66,15 @@ def exclude_domain(self) -> None: | |||
|
|||
def on_off_states(self, on_states: set, off_state: str) -> None: | |||
"""Register on and off states for the current domain.""" | |||
domain = current_domain.get() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a follow-up PR, the context variable should be removed, and domain
should be passed instead. There's a single custom integration published in HACS - bodymiscale
- which also implements mixed group support so a breaking change + blog post + notifying the author of bodymiscale
should be fine.
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Btw, this is not a code quality improvement, this is a breaking change because it changes how |
I'd rather call this a bugfix as the docs seem clear. |
Why you consider old behaviour a bug?
https://www.home-assistant.io/integrations/group/ |
Well as you can see in some fixed texts, that sometimes worked. E.g. the state of a |
When reading the breaking change note it's not clear to me what the change is. Maybe improve the examples to explain what the behavior was before the change, not just what it is after the change? |
Co-authored-by: Erik Montnemery <erik@montnemery.com>
Updated the examples a bit to show the difference. |
The |
https://www.home-assistant.io/integrations/group/ says: When member entities all have a single
|
core/homeassistant/components/lock/group.py Lines 12 to 17 in e9e401a
|
You are right, updated the PR breaking section |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Breaking change
The state of a group entity will now return a specific
ON
orOFF
state, even if the entity component supports multipleON
states, if the group state is on, and there and theON
states are from entities from a single domain, and oneON
state used. E.g. all switched on vacuum's arecleaning
-> theon
state will becleaning
. The previous behavior was that the group state wasON
.Users should check their automation's still work correctly if they are based on
group
states.Proposed change
Return specific group state if there is one. This prepares the
group
integration to handle integrations that have entities with multipleon
states, likevacuum
and likelock
will have.Added test cases for vacuum to assert with multiple on states.
This also prepares the
lock
integration can share anOPEN
state withcover
.Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: