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 GitHub
parent 3c635fdbf2
commit be44de0a41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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