diff --git a/src/panels/lovelace/cards/hui-area-card.ts b/src/panels/lovelace/cards/hui-area-card.ts index f81ecb6124..1d8c0469db 100644 --- a/src/panels/lovelace/cards/hui-area-card.ts +++ b/src/panels/lovelace/cards/hui-area-card.ts @@ -394,6 +394,10 @@ export class HuiAreaCard extends LitElement implements LovelaceCard { const values: number[] = []; let uom: string | undefined; + // Track devices that have sensor entities contributing values + // to avoid duplicate readings from climate/humidifier attributes + const devicesWithSensorValues = new Set(); + for (const entityId of sensorEntityIds) { const stateObj = this.hass.states[entityId]; if ( @@ -407,6 +411,11 @@ export class HuiAreaCard extends LitElement implements LovelaceCard { } if (stateObj.attributes.unit_of_measurement === uom) { values.push(Number(stateObj.state)); + // Track the device this sensor belongs to + const entityEntry = this.hass.entities[entityId]; + if (entityEntry?.device_id) { + devicesWithSensorValues.add(entityEntry.device_id); + } } } } @@ -426,6 +435,15 @@ export class HuiAreaCard extends LitElement implements LovelaceCard { const stateObj = this.hass.states[entityId]; if (!stateObj) continue; + // Skip if this entity's device already has a sensor contributing values + const entityEntry = this.hass.entities[entityId]; + if ( + entityEntry?.device_id && + devicesWithSensorValues.has(entityEntry.device_id) + ) { + continue; + } + const domain = entityId.split(".")[0]; const source = attrSources.find((s) => s.domain === domain); if (!source) continue;