Filter out zero readings for DSMR enery sensors (#104843)

This commit is contained in:
Jan Bouwhuis 2023-11-30 23:42:51 +01:00 committed by GitHub
parent 00e57ab9a4
commit 7767bb328d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 3 deletions

View file

@ -799,6 +799,10 @@ class DSMREntity(SensorEntity):
float(value), self._entry.data.get(CONF_PRECISION, DEFAULT_PRECISION)
)
# Make sure we do not return a zero value for an energy sensor
if not value and self.state_class == SensorStateClass.TOTAL_INCREASING:
return None
return value
@staticmethod