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

Add the ability to bind the group helper entity to a device #118008

Closed
wants to merge 14 commits into from

Conversation

dougiteixeira
Copy link
Contributor

@dougiteixeira dougiteixeira commented May 24, 2024

Breaking change

None

Proposed change

This PR adds the option for the user to bind the group entity configured from the UI to a device.

This is a much requested feature, for example in these posts:

I believe the device selector is a good way out of this, giving the user direct control over the helper/device link.

If you accept this implementation, I think about extending it to other helpers that do not inherit the device from their source entity.

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

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

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

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.

@jpbede

This comment was marked as resolved.

@jpbede jpbede closed this May 24, 2024
@jpbede jpbede reopened this May 24, 2024
@jpbede
Copy link
Member

jpbede commented May 24, 2024

Re-opened, didn't see that this is the group helper not template helper as in #117753, sry :)

@gjohansson-ST
Copy link
Member

Why not just attach to the right devices which the entities belong to instead of making the user has to select?

@dougiteixeira
Copy link
Contributor Author

Why not just attach to the right devices which the entities belong to instead of making the user has to select?

Because a group can be composed of entities from several different devices. In my opinion, it makes more sense for the user to select the device, as we will have fewer complaints than the integration trying to obtain an entity as a reference for the device.

@gjohansson-ST
Copy link
Member

Because a group can be composed of entities from several different devices. In my opinion, it makes more sense for the user to select the device, as we will have fewer complaints than the integration trying to obtain an entity as a reference for the device.

That's somehow my point. If you have a group of 5 lights. Why wouldn't you want to attach the group entity to all 5 of them?
It does not make sense to have the user to manually select the 5 devices with the risk of choosing the incorrect one etc.

@dougiteixeira
Copy link
Contributor Author

That's somehow my point. If you have a group of 5 lights. Why wouldn't you want to attach the group entity to all 5 of them?
It does not make sense to have the user to manually select the 5 devices with the risk of choosing the incorrect one etc.

But an entity can be attached to only one device, it is not possible to attach on all five devices.

Or am I wrong?

@dougiteixeira
Copy link
Contributor Author

The idea is to expand this behavior to all helpers that do not have just one source/reference entity.

Thinking that the user is creating the entity, in the same way that he selects device class, unit, etc. (in some types of helpers), he would select the device on which he wants the entity to be linked.

This in addition to making helpers more accessible through the user interface and would meet users' recurring requests.

@gjohansson-ST
Copy link
Member

But an entity can be attached to only one device, it is not possible to attach on all five devices.

I think you can manually do so, but I'm not sure that makes sense either.
I personally don't think this is the right approach.

@dougiteixeira
Copy link
Contributor Author

dougiteixeira commented May 26, 2024

I personally don't think this is the right approach.

The alternative is to keep it as is, without a link to the device? I see no other acceptable and reliable solution.

@Torgrima
Copy link

Torgrima commented May 30, 2024

This is a feature I have wished I have had for a long time, I hope it get merged.
First steps to making it possible to associate any helper to a device or create a device based on custom template sensors / helpers.

I have several helpers belonging to multiple devices.
E.g helpers for mi flora pots where a zone in the greenhouse could be a device, where all the flowerpots is a child device in the greenhouse. entities like light, Co2...

@frenck
Copy link
Member

frenck commented Jun 20, 2024

Hi there @dougiteixeira 👋

We've discussed this PR with some people on the core team, and we've decided not to move forward with it.

While adding the ability to bind the group helper entity to a device is technically cool, the core team feels that this feature doesn't align with the information architecture of Home Assistant. Looking at it from that perspective, groups are meant to combine different data points or controls from different devices and are thus above this all.

Nevertheless, thanks for being willing to contribute 👍

../Frenck

@frenck frenck closed this Jun 20, 2024
@Torgrima
Copy link

Home assistant is definitely missing the possibility to create a device from a group of templates and helpers.
Especially, if home-assistant will support blueprint for templating/helpers.

@frenck
Copy link
Member

frenck commented Jun 21, 2024

@Torgrima This is not the right place for feature requests. Place use our community forums for that purpose.

Thanks! 👍

../Frenck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants