Compare commits

...
3 Commits
Author SHA1 Message Date
GeorgeSG e7aade9647 Merge pull request #67 from bramkragten/entity-name-followup
Keep an empty name meaning Home Assistant's own name
2026-09-30 11:18:19 +03:00
Bram KragtenandClaude Opus 5 769176243f Reflow the name union after dropping parent_device
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 23:36:54 +02:00
Bram KragtenandClaude Opus 5 7fc93eecea Keep an empty name meaning "use Home Assistant's name"
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>
2026-09-17 12:48:36 +01:00
3 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -174,7 +174,7 @@ name:
- type: entity
```
Available part types are `entity`, `device`, `parent_device`, `area`, `floor`, and
Available part types are `entity`, `device`, `area`, `floor`, and
`text` (a literal, written as `{type: text, text: 'Alarm'}`). Parts that resolve to
nothing are dropped. A plain string `name` keeps working exactly as before, and the
visual editor offers both modes on Home Assistant 2025.11 and later.
+5
View File
@@ -43,6 +43,11 @@ export function computeEntityName(
stateObj: HassEntity | undefined,
name: EntityName | undefined,
): string | undefined {
// A configured empty name has always meant "use Home Assistant's name", but
// formatEntityName returns any string verbatim - including the empty one, which
// would blank the label. Normalise it to undefined so the formatter composes.
if (name === '') name = undefined;
const configuredName = typeof name === 'string' ? name : undefined;
if (!stateObj) {
+1 -2
View File
@@ -20,8 +20,7 @@ export interface TimePickerCardConfig extends LovelaceCardConfig {
export type EntityName = string | EntityNameItem | EntityNameItem[];
export type EntityNameItem =
| { type: 'entity' | 'device' | 'parent_device' | 'area' | 'floor' }
| { type: 'text'; text: string };
{ type: 'entity' | 'device' | 'area' | 'floor' } | { type: 'text'; text: string };
export type HourMode = 12 | 24 | undefined;