Add the shared NestQuest data update coordinator
One refresh pass builds the whole entity snapshot: active children, today's instances with derived open/done/missed states, per-child presence via the PresenceEngine (records converted to model objects), rollup counts, and the custody cycle day. Interval configurable via the new update_interval option, default five minutes.
This commit is contained in:
@@ -128,6 +128,21 @@ def _derived_state(
|
||||
)
|
||||
|
||||
|
||||
def derive_state(
|
||||
instance: QuestInstanceRecord,
|
||||
latest: CompletionEventRecord | None,
|
||||
today: datetime.date,
|
||||
) -> str:
|
||||
"""Public state derivation for the Feature 10 coordinator.
|
||||
|
||||
Thin wrapper over :func:`_derived_state`: ``open``, ``done``, or
|
||||
``missed`` from the latest event plus the due date (``missed`` is
|
||||
derived, never an event_type). ``today`` is the caller-resolved
|
||||
HA-local date.
|
||||
"""
|
||||
return _derived_state(instance, latest, today)
|
||||
|
||||
|
||||
def _was_on_time(
|
||||
instance: QuestInstanceRecord,
|
||||
now: datetime.datetime | None,
|
||||
|
||||
Reference in New Issue
Block a user