mirror of
https://github.com/home-assistant/core.git
synced 2025-08-03 20:55:10 +02:00
restore float and not string (#56406)
This commit is contained in:
@@ -306,7 +306,11 @@ class UtilityMeterSensor(RestoreEntity, SensorEntity):
|
||||
if state:
|
||||
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_period = (
|
||||
float(state.attributes.get(ATTR_LAST_PERIOD))
|
||||
if state.attributes.get(ATTR_LAST_PERIOD)
|
||||
else 0
|
||||
)
|
||||
self._last_reset = dt_util.as_utc(
|
||||
dt_util.parse_datetime(state.attributes.get(ATTR_LAST_RESET))
|
||||
)
|
||||
|
Reference in New Issue
Block a user