Fallback to state name when the entry doesn't have name (#24805)

This commit is contained in:
Paul Bottein 2025-03-27 18:51:08 +01:00
parent 1770a51303
commit 3b6e267fb5
No known key found for this signature in database
2 changed files with 9 additions and 2 deletions

View File

@ -33,7 +33,14 @@ export const computeEntityEntryName = (
const device = entry.device_id ? hass.devices[entry.device_id] : undefined;
if (!device) {
return name;
if (name) {
return name;
}
const stateObj = hass.states[entry.entity_id] as HassEntity | undefined;
if (stateObj) {
return computeStateName(stateObj);
}
return undefined;
}
const deviceName = computeDeviceName(device);

View File

@ -319,7 +319,7 @@ export class MoreInfoDialog extends LitElement {
const breadcrumb = [areaName, deviceName, entityName].filter(
(v): v is string => Boolean(v)
);
const title = this._childView?.viewTitle || breadcrumb.pop();
const title = this._childView?.viewTitle || breadcrumb.pop() || entityId;
return html`
<ha-dialog