361 files
This commit is contained in:
@@ -14,6 +14,7 @@ from homeassistant.auth import EVENT_USER_REMOVED
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import ATTR_ENTITY_ID, EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import (
|
||||
CoreState,
|
||||
Event,
|
||||
HomeAssistant,
|
||||
ServiceCall,
|
||||
@@ -1502,6 +1503,15 @@ async def async_setup_entry(hass: HomeAssistant, entry: MaintenanceSupporterConf
|
||||
await todo_mirror.async_setup()
|
||||
hass.data[DOMAIN][TODO_MIRROR_KEY] = todo_mirror
|
||||
|
||||
# 2026-10 places: tell a person what is due where they just arrived —
|
||||
# same lifecycle as the mirrors (global entry owns it).
|
||||
from .helpers.places import PLACES_KEY, PlaceArrivals
|
||||
|
||||
if PLACES_KEY not in hass.data[DOMAIN]:
|
||||
place_arrivals = PlaceArrivals(hass)
|
||||
place_arrivals.async_setup()
|
||||
hass.data[DOMAIN][PLACES_KEY] = place_arrivals
|
||||
|
||||
# One-time migration: auto-enable advanced feature flags for existing users
|
||||
options = dict(entry.options or entry.data)
|
||||
if CONF_ADVANCED_ADAPTIVE not in options:
|
||||
@@ -1727,6 +1737,14 @@ async def async_setup_entry(hass: HomeAssistant, entry: MaintenanceSupporterConf
|
||||
entry.runtime_data = MaintenanceSupporterData(coordinator=coordinator, store=store)
|
||||
await coordinator.async_config_entry_first_refresh()
|
||||
|
||||
# A shopping-list row checked while this object was not loaded (a
|
||||
# reload after a task edit, a setup retry) waits for it — the resync
|
||||
# books it now. At startup the pass after "started" covers it.
|
||||
if hass.state is CoreState.running:
|
||||
from .shopping_sync import schedule_resync
|
||||
|
||||
schedule_resync(hass)
|
||||
|
||||
# #148: a battery type that becomes known only after fleet setup (a
|
||||
# Battery Notes note added later, a typed low-only Matter binary)
|
||||
# never got its spare part — reconcile once per start, after the
|
||||
@@ -2118,6 +2136,11 @@ async def async_unload_entry(hass: HomeAssistant, entry: MaintenanceSupporterCon
|
||||
todo_mirror = hass.data.get(DOMAIN, {}).pop(TODO_MIRROR_KEY, None)
|
||||
if todo_mirror is not None:
|
||||
todo_mirror.async_teardown()
|
||||
from .helpers.places import PLACES_KEY
|
||||
|
||||
place_arrivals = hass.data.get(DOMAIN, {}).pop(PLACES_KEY, None)
|
||||
if place_arrivals is not None:
|
||||
place_arrivals.async_teardown()
|
||||
# NOT the full-text index: it is shared runtime (built once per boot
|
||||
# by _async_setup_shared, which a hub reload does not re-run) — a
|
||||
# reload of the global entry (any settings save) closed it for the
|
||||
|
||||
Reference in New Issue
Block a user