Fix overkiz measurement sensor returns None if 0 (#105090)

This commit is contained in:
Jan Bouwhuis
2023-12-05 20:00:53 +01:00
committed by Franck Nijhof
parent ae4811b776
commit f7c9d20472

View File

@@ -481,7 +481,12 @@ class OverkizStateSensor(OverkizDescriptiveEntity, SensorEntity):
"""Return the value of the sensor."""
state = self.device.states.get(self.entity_description.key)
if not state or not state.value:
if (
state is None
or state.value is None
or self.state_class != SensorStateClass.MEASUREMENT
and not state.value
):
return None
# Transform the value with a lambda function