Repository navigation
Resolve entity names through formatEntityName - #187
Closed
bramkragten wants to merge 2 commits into
Closed
bramkragten wants to merge 2 commits into
bramkragten wants to merge 2 commits into
Conversation
The three entity dropdowns in the editor labelled their options with the friendly_name attribute, which is the flat legacy name and ignores the entity/device/area naming users configure in Home Assistant. The card title now goes through the same helper, so `name` also accepts a structured name and can be composed from the device or area name instead of being a fixed string that goes stale on a rename. The editor offers Home Assistant's own picker for it on 2026.4 and later, and keeps the plain text field on older versions, which cannot resolve one. Ref: home-assistant/frontend#51686 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
formatEntityName returns any string it is given verbatim, the empty one included, so `name: ''` blanked the label where it previously fell through to the friendly name. It now reaches the formatter as undefined. Also drops `parent_device` from the accepted name parts. It only landed in the frontend on 2026-09-10 and is in no release yet, so under the 2026.4 gate it was silently ignored. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
What
The three entity dropdowns in the editor (TV entity, and the A/V receiver entity in both branches) labelled their options with
states[eid].attributes.friendly_name.friendly_nameis the flat legacy name: it does not follow the entity/device/area/floor naming users configure everywhere else in Home Assistant, so the dropdown can show a different name than the rest of the dashboard does for the same entity.They now go through
hass.formatEntityName, the helper the built-in cards use.The card title uses the same helper, which means
namealso accepts a structured name:Users can therefore compose the title from the device or area name instead of typing a fixed string that goes stale when they rename something. The editor offers Home Assistant's own name picker for this on 2026.4 and later. A plain string
namebehaves exactly as before, and no title is shown whennameis unset, as today.Compatibility
formatEntityNameonly accepts anameargument from HA 2026.4; earlier versions expose the same helper with an incompatible signature, and ahasscan report a recent version without carrying the helper at all.src/entity-name.tschecks both and falls back tofriendly_nameotherwise, and the editor keeps the plain text field on those versions, so nothing changes for users who have not updated.Context
Part of home-assistant/frontend#51686, which tracks moving custom cards off
friendly_name.Testing
npx tsc --noEmitis clean andnpm run rollupbuilds. README documents the extendednameoption.🤖 Generated with Claude Code