Skip to content

Fix empty entity name display#51475

Draft
arturpragacz wants to merge 1 commit into
home-assistant:devfrom
arturpragacz:fix-empty-entity-name-display
Draft

Fix empty entity name display#51475
arturpragacz wants to merge 1 commit into
home-assistant:devfrom
arturpragacz:fix-empty-entity-name-display

Conversation

@arturpragacz
Copy link
Copy Markdown
Member

@arturpragacz arturpragacz commented Apr 8, 2026

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-info was 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_name template function.

Screenshots

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • 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 or discussion:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to backend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

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

To help with the load of incoming pull requests:

@piitaya
Copy link
Copy Markdown
Member

piitaya commented Apr 8, 2026

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.

@arturpragacz
Copy link
Copy Markdown
Member Author

This is related to #51684.

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.

2 participants