Skip to content

Commit 99bc50d

Browse files
Merge pull request #22 from DennisZschoppe/master
Update sensor.py
2 parents f3e15b3 + 261e9c3 commit 99bc50d

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

custom_components/kaco/sensor.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,19 +165,19 @@ def native_value(self):
165165

166166
@property
167167
def device_class(self):
168-
return (
169-
SensorDeviceClass.ENERGY
170-
if self._unit == UnitOfEnergy.KILO_WATT_HOUR
171-
else None
172-
)
168+
if self._unit == UnitOfEnergy.KILO_WATT_HOUR:
169+
return SensorDeviceClass.ENERGY
170+
if self._unit in ["W", "kW"]:
171+
return SensorDeviceClass.POWER
172+
return None
173173

174174
@property
175175
def state_class(self):
176-
return (
177-
"total_increasing"
178-
if self._unit == UnitOfEnergy.KILO_WATT_HOUR
179-
else None
180-
)
176+
if self._unit == UnitOfEnergy.KILO_WATT_HOUR:
177+
return "total_increasing"
178+
if self._unit in ["W", "kW"]:
179+
return "measurement"
180+
return None
181181

182182
# Wichtig: **keine** eigene `available`-Property überschreiben.
183183
# Wir nutzen die von `CoordinatorEntity`, die auf `last_update_success` basiert.

0 commit comments

Comments
 (0)