mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-20 07:46:37 +00:00
Use entity format state if only one entity for that domain in the area card (#25964)
Use entity format state if only one entity is area card
This commit is contained in:
parent
22c798c9d6
commit
9d8a5b366e
@ -348,6 +348,14 @@ export class HuiAreaCard extends LitElement implements LovelaceCard {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// If only one entity, return its formatted state
|
||||
if (entities.length === 1) {
|
||||
const stateObj = entities[0];
|
||||
return isUnavailableState(stateObj.state)
|
||||
? ""
|
||||
: this.hass.formatEntityState(stateObj);
|
||||
}
|
||||
|
||||
// Use the first entity's unit_of_measurement for formatting
|
||||
const uom = entities.find(
|
||||
(entity) => entity.attributes.unit_of_measurement
|
||||
|
Loading…
x
Reference in New Issue
Block a user