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.
Proposed change
This changes the unique id for groups to align with the unique id from current HA ZHA, so we don't create a new entity.
The test is also changed to check for the new unique id. (The tests in HA never check the unique id)
There's still an issue left with the default name not using the group name and always being "Light group" that's explained below. That should be addressed in a future PR.
Issue left: default name
There still seems to be an issue with the default name shown in HA.
This might be because HA expects the
_attr_name
attribute for a custom name, but the ZHA library never sets that. It uses_name
and exposes it as thename
property.An example of old/new entity registry entries follows below.
Entity registry entries
I've created a ZHA group called "ZHA Group ID 3". The entity in the registry is regenerated on the current HA ZHA integration and afterwards with the ZHA library. A custom name is not set (as seen by
name = null
), so theoriginal_name
is used.By default, this should be the ZHA group name, so "ZHA Group ID 3". It's also used for the entity id suffix then.
With the ZHA library, this always seems to be "Light group" for now (also resulting in the less descriptive entity id). That should be fixed in a future PR.
Current HA ZHA (good)
Generated with this PR (unique id is good now, name not)