Fix empty entity name display#51475
Draft
arturpragacz wants to merge 1 commit into
Draft
Conversation
Member
|
Thanks for the PR but I don't think we should merge it like this. Falling back to device name when entity name is empty is intentional and used everywhere in the frontend, not just in cards. It was decided with product to avoid empty names in dashboards and cases like "Floor lamp Floor lamp". If we want to change it, it has to be done everywhere, with a proper way to show empty names (like "-") and an improved entity settings name field. Now that we want to finish the entity naming migration, I'm ok to revisit this and align with the new entity_name template, but let's agree on the global pattern first before changing it in one place. |
Member
Author
|
This is related to #51684. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Breaking change
Proposed change
Fix empty entity name display.
When an entity has empty entity name, the displayed name would change unpredictably. For example, with a "Device" device and "Kitchen" area:
[device, area]-> "Device Kitchen"[area, entity]-> "Kitchen Device"[device, area, entity]-> "Device Kitchen"In comparison for the same device with entity "Power":
[device, area]-> "Device Kitchen"[area, entity]-> "Kitchen Power"[device, area, entity]-> "Device Kitchen Power"Now entity always resolves to the entity's own name. If the entity has empty name, it resolves to nothing, the device name only appears where it's explicitly configured.
Backwards compatibility for
state-infowas also added, as it already exists in other places. As a side note I think we should instead show it in some special way everywhere, and not just duplicate device name, as it leads to user confusion.It also now causes compatibility issues with the new
entity_nametemplate function.Screenshots
Type of change
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed:
To help with the load of incoming pull requests: