1
0
mirror of https://github.com/home-assistant/frontend.git synced 2026-04-02 00:27:49 +01:00

Fix distribution card stub error (#29915)

* Fix distribution card stub error

* unit check not required
This commit is contained in:
karwosts
2026-03-01 23:06:10 -08:00
committed by Bram Kragten
parent 38d02a3f30
commit c3cc566fe3

View File

@@ -68,9 +68,9 @@ export class HuiDistributionCard
// Strategy 1: Try to find power sensors (W, kW) - most common use case
const powerFilter = (stateObj: HassEntity): boolean => {
const unit = stateObj.attributes.unit_of_measurement;
const stateValue = Number(stateObj.state);
return (unit === "W" || unit === "kW") && !isNaN(stateValue);
const deviceClass = stateObj.attributes.device_class;
return deviceClass === "power" && !isNaN(stateValue);
};
let foundEntities = findEntities(