RFC - Add a 3rd state to the HA shutdown sequence for writing… (#33358)
* add third stage to hass shutdown * use 3rd stage in storage * update core state * add writing data to multi stop ignore * update core test * review comment * update name based on feedback
This commit is contained in:
1 parent
01bf4daf37
commit
bcd1eb952c
6 files changed
+27
-8
No files matched your search
@@ -4,7 +4,10 @@ from datetime import datetime, timedelta
|
||||
import logging
|
||||
from typing import Any, Awaitable, Dict, List, Optional, Set, cast
|
||||
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.const import (
|
||||
EVENT_HOMEASSISTANT_FINAL_WRITE,
|
||||
EVENT_HOMEASSISTANT_START,
|
||||
)
|
||||
from homeassistant.core import (
|
||||
CoreState,
|
||||
HomeAssistant,
|
||||
@@ -184,7 +187,9 @@ class RestoreStateData:
|
||||
async_track_time_interval(self.hass, _async_dump_states, STATE_DUMP_INTERVAL)
|
||||
|
||||
# Dump states when stopping hass
|
||||
self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _async_dump_states)
|
||||
self.hass.bus.async_listen_once(
|
||||
EVENT_HOMEASSISTANT_FINAL_WRITE, _async_dump_states
|
||||
)
|
||||
|
||||
@callback
|
||||
def async_restore_entity_added(self, entity_id: str) -> None:
|
||||
|
||||
Reference in new issue
Block a user