Skip to content
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

Explicit support for old style (legacy) groups #116664

Closed
wants to merge 2 commits into from
Closed

Conversation

jbouwh
Copy link
Contributor

@jbouwh jbouwh commented May 2, 2024

Breaking change

Legacy groups explicit supported means that we do no longer implicit support legacy groups form (custom)domains that and on off state.
Only the domains in the documentation are supported.

Proposed change

Instead of allowing any entity in a mixed group, entity platforms must be supported explictly. Custom integrations can stall implement async_describe_on_off_states in the group.py module and register on_off_states, but we no longer allow new domains to implement support for legacy groups.

Or in other words, without this PR mixed groups support:

  • Any domain with on/off states
  • Domains which have a group platform

The PR changes this to:

  • A list of domains with on/off states
  • Domains which have a group platform

The open blog post PR home-assistant/developers.home-assistant#2157 was updated to include these changes.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant
Copy link

home-assistant bot commented May 2, 2024

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (air_quality) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of air_quality can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign air_quality Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@home-assistant
Copy link

home-assistant bot commented May 2, 2024

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (group) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of group can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign group Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@home-assistant
Copy link

home-assistant bot commented May 2, 2024

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (sensor) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of sensor can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign sensor Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@home-assistant
Copy link

home-assistant bot commented May 2, 2024

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (weather) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of weather can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign weather Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

self.state_group_mapping: dict[str, SingleStateType] = {}

@callback
def exclude_domain(self, domain: str) -> None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep this method to not make it a breaking change, and just make it a no op and log a warning that it's deprecated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was already a breaking change as we changed the signature for the registry method (#116317). I do not expect this to break anything. The removal is mentioned in the blog post though.

homeassistant/components/group/registry.py Outdated Show resolved Hide resolved
@@ -16,6 +16,23 @@

from .const import DOMAIN, REG_KEY

EXPLICT_SUPPORTED_ON_OFF_DOMAINS = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these domains are not documented as supported by the old style groups in the user docs. We should probably add them to the docs list.

https://www.home-assistant.io/integrations/group/#old-style-groups

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are some of the domains in the user docs list not included in this set, eg alarm_control_panel? Are those the single state types?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These domains explicit register their states and their domain will be added to supported_domains.

The documentation was updated to the new list already with:

#116318 and home-assistant/home-assistant.io#32574.

The single state types of the combinations of on/off, open/closed, home/not_home and locked/unlocked

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list only contains the explicit list of domains with the on/off single state.

@@ -292,7 +292,7 @@ def _set_tracked(self, entity_ids: Collection[str] | None) -> None:
return

registry: GroupIntegrationRegistry = self.hass.data[REG_KEY]
excluded_domains = registry.exclude_domains
supported_domains = registry.supported_domains
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we rename the local variable to supported_on_off_domains to make it more clear what it should contain?

Copy link
Contributor Author

@jbouwh jbouwh May 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

supported_domains will be extended with the domains the register alternate state (other then on/off. This is also the route for custom integrations to make sure they do not break. As far as we know there is one HACS integration that supports legacy groups and the maintainer was notified.

@MartinHjelmare MartinHjelmare added the second-opinion-wanted Add this label when a reviewer needs a second opinion from another member. label May 3, 2024
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
@jbouwh
Copy link
Contributor Author

jbouwh commented May 10, 2024

Closing as there are no plans to explictly exclude (custom)integrations.

@jbouwh jbouwh closed this May 10, 2024
@gjohansson-ST gjohansson-ST deleted the group-explicit-support branch May 10, 2024 08:14
@github-actions github-actions bot locked and limited conversation to collaborators May 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants