mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 19:56:42 +00:00
Use area entities in area card for temperature and humidity (#23842)
Use area entities in area card for temperature and humidity instead of average
This commit is contained in:
parent
1532093426
commit
666316e44a
@ -376,7 +376,20 @@ export class HuiAreaCard
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._deviceClasses[domain].forEach((deviceClass) => {
|
this._deviceClasses[domain].forEach((deviceClass) => {
|
||||||
|
let areaSensorEntityId: string | null = null;
|
||||||
|
switch (deviceClass) {
|
||||||
|
case "temperature":
|
||||||
|
areaSensorEntityId = area.temperature_entity_id;
|
||||||
|
break;
|
||||||
|
case "humidity":
|
||||||
|
areaSensorEntityId = area.humidity_entity_id;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const areaEntity = areaSensorEntityId
|
||||||
|
? this.hass.states[areaSensorEntityId]
|
||||||
|
: undefined;
|
||||||
if (
|
if (
|
||||||
|
areaEntity ||
|
||||||
entitiesByDomain[domain].some(
|
entitiesByDomain[domain].some(
|
||||||
(entity) => entity.attributes.device_class === deviceClass
|
(entity) => entity.attributes.device_class === deviceClass
|
||||||
)
|
)
|
||||||
@ -388,7 +401,9 @@ export class HuiAreaCard
|
|||||||
.domain=${domain}
|
.domain=${domain}
|
||||||
.deviceClass=${deviceClass}
|
.deviceClass=${deviceClass}
|
||||||
></ha-domain-icon>
|
></ha-domain-icon>
|
||||||
${this._average(domain, deviceClass)}
|
${areaEntity
|
||||||
|
? this.hass.formatEntityState(areaEntity)
|
||||||
|
: this._average(domain, deviceClass)}
|
||||||
</div>
|
</div>
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user