Improve code

This commit is contained in:
Paul Bottein 2025-07-03 19:17:53 +02:00
parent 9a12d563ec
commit efbfff9a4f
No known key found for this signature in database

View File

@ -307,7 +307,7 @@ export class MoreInfoDialog extends LitElement {
deviceName = this.hass.formatEntityName(stateObj, "device");
areaName = this.hass.formatEntityName(stateObj, "area");
} else if (this._entry) {
const context = getEntityEntryContext(
const { device, area } = getEntityEntryContext(
this._entry,
this.hass.entities,
this.hass.devices,
@ -315,10 +315,8 @@ export class MoreInfoDialog extends LitElement {
this.hass.floors
);
entityName = computeEntityEntryName(this._entry, this.hass.devices);
deviceName = context?.device
? computeDeviceName(context.device)
: undefined;
areaName = context?.area ? computeAreaName(context.area) : undefined;
deviceName = device ? computeDeviceName(device) : undefined;
areaName = area ? computeAreaName(area) : undefined;
} else {
entityName = entityId;
}