Skip to content

Commit d467bd7

Browse files
committed
fix issue with 0 value
1 parent 92a5dc8 commit d467bd7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

custom_components/ocpp/sensor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,15 @@ def native_value(self):
174174
value = self.central_system.get_metric(self.cp_id, self.metric)
175175
if isinstance(value, float):
176176
value = round(value, self.entity_description.scale)
177-
if value:
177+
if value is not None:
178178
self._attr_native_value = value
179179
return self._attr_native_value
180180

181181
@property
182182
def native_unit_of_measurement(self):
183183
"""Return the native unit of measurement."""
184184
value = self.central_system.get_ha_unit(self.cp_id, self.metric)
185-
if value:
185+
if value is not None:
186186
self._attr_native_unit_of_measurement = value
187187
return self._attr_native_unit_of_measurement
188188

0 commit comments

Comments
 (0)