avoid setting _last_period to None

pull/66490/head
Diogo Gomes 2022-02-14 21:16:52 +00:00
parent 1d082d3ca6
commit bd3e2e2afe
1 changed files with 1 additions and 1 deletions

View File

@ -283,7 +283,7 @@ class UtilityMeterSensor(RestoreEntity, SensorEntity):
return
_LOGGER.debug("Reset utility meter <%s>", self.entity_id)
self._last_reset = dt_util.utcnow()
self._last_period = str(self._state)
self._last_period = str(self._state) if self._state else 0
self._state = 0
self.async_write_ha_state()