Skip to content
Snippets Groups Projects
Unverified Commit 12adde53 authored by Diogo Gomes's avatar Diogo Gomes Committed by GitHub
Browse files

On HA restart parse last_reset as a datetime object (#42939)

parent 42cdbc7e
No related branches found
No related tags found
No related merge requests found
...@@ -264,7 +264,9 @@ class UtilityMeterSensor(RestoreEntity): ...@@ -264,7 +264,9 @@ class UtilityMeterSensor(RestoreEntity):
self._state = Decimal(state.state) self._state = Decimal(state.state)
self._unit_of_measurement = state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) self._unit_of_measurement = state.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
self._last_period = state.attributes.get(ATTR_LAST_PERIOD) self._last_period = state.attributes.get(ATTR_LAST_PERIOD)
self._last_reset = state.attributes.get(ATTR_LAST_RESET) self._last_reset = dt_util.parse_datetime(
state.attributes.get(ATTR_LAST_RESET)
)
self.async_write_ha_state() self.async_write_ha_state()
if state.attributes.get(ATTR_STATUS) == PAUSED: if state.attributes.get(ATTR_STATUS) == PAUSED:
# Fake cancellation function to init the meter paused # Fake cancellation function to init the meter paused
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment