Fix zwave_js sensor device class attribute error (#45863)
This commit is contained in:
parent
811bbb7acb
commit
c93fec34b3
1 changed files with 4 additions and 1 deletions
|
@ -73,7 +73,10 @@ class ZwaveSensorBase(ZWaveBaseEntity):
|
|||
if self.info.primary_value.metadata.unit == "kWh":
|
||||
return DEVICE_CLASS_ENERGY
|
||||
return DEVICE_CLASS_POWER
|
||||
if "temperature" in self.info.primary_value.property_.lower():
|
||||
if (
|
||||
isinstance(self.info.primary_value.property_, str)
|
||||
and "temperature" in self.info.primary_value.property_.lower()
|
||||
):
|
||||
return DEVICE_CLASS_TEMPERATURE
|
||||
if self.info.primary_value.metadata.unit == "W":
|
||||
return DEVICE_CLASS_POWER
|
||||
|
|
Loading…
Add table
Reference in a new issue