From 12adde5349fc63ba129a64bf1f2b72bb4f2a3dee Mon Sep 17 00:00:00 2001 From: Diogo Gomes Date: Mon, 9 Nov 2020 07:35:50 +0000 Subject: [PATCH] On HA restart parse last_reset as a datetime object (#42939) --- homeassistant/components/utility_meter/sensor.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/utility_meter/sensor.py b/homeassistant/components/utility_meter/sensor.py index 54f93422abd..e365e77071c 100644 --- a/homeassistant/components/utility_meter/sensor.py +++ b/homeassistant/components/utility_meter/sensor.py @@ -264,7 +264,9 @@ class UtilityMeterSensor(RestoreEntity): self._state = Decimal(state.state) self._unit_of_measurement = state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) 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() if state.attributes.get(ATTR_STATUS) == PAUSED: # Fake cancellation function to init the meter paused