feat!: binary sensors and control panels generates a valid Entity ID with a human readable name #54
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.
Related Issues
Proposed Changes:
This change ensures that the self-generated
entity_id
is a valid HA Entity ID, while keeping the name in a human readable format. The validation is done via tests usingvalid_entity_id()
HA core function and is not validated at runtime (there is no reasons to do that live).Even if the integration was working properly, entities were not respecting the official
entity_id
format:<domain>.<entity_id>
. With this change,domain
is included in the Entity ID even though it is remove by HA for unclear reasons. This behavior is described in the official documentation: https://www.home-assistant.io/faq/unique_id/#can-be-changedExample
Before:
After:
Testing:
Install the integration before the change and after the change. If
name
is not set with a "friendly name", you should see this change.Extra Notes (optional):
n/a
Checklist