mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
parent
e272e3c721
commit
198608906c
@ -296,9 +296,9 @@ class WasherDryerTimeClass(RestoreSensor):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isinstance(self._attr_native_value, datetime)
|
self._attr_native_value is None
|
||||||
|
or isinstance(self._attr_native_value, datetime)
|
||||||
and abs(new_timestamp - self._attr_native_value) > timedelta(seconds=60)
|
and abs(new_timestamp - self._attr_native_value) > timedelta(seconds=60)
|
||||||
or self._attr_native_value is None
|
|
||||||
):
|
):
|
||||||
self._attr_native_value = new_timestamp
|
self._attr_native_value = new_timestamp
|
||||||
self._async_write_ha_state()
|
self._async_write_ha_state()
|
||||||
|
@ -311,10 +311,11 @@ async def test_no_restore_state(
|
|||||||
await init_integration(hass)
|
await init_integration(hass)
|
||||||
# restore from cache
|
# restore from cache
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
state.state = "unknown"
|
assert state.state == "unknown"
|
||||||
|
|
||||||
|
mock_sensor1_api.get_machine_state.return_value = MachineState.RunningMainCycle
|
||||||
state = await update_sensor_state(hass, entity_id, mock_sensor1_api)
|
state = await update_sensor_state(hass, entity_id, mock_sensor1_api)
|
||||||
state.state = datetime.now().isoformat()
|
assert state.state != "unknown"
|
||||||
|
|
||||||
|
|
||||||
async def test_callback(
|
async def test_callback(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user