Add core/settings.py: a frozen, HA-free NestQuestSettings dataclass carrying horizon_days, day_rollover_time, notify_target, the three notification times, and the four enable toggles. from_options() reads the CONF_* keys with the matching defaults and validates (horizon int >= 1, strict HH:MM times, real booleans); horizon_window(today) returns the rolling [today, today+horizon_days] window. The integration builds the settings object once from entry.options and threads it into the horizon materialization and daily-rollover listener; core never reads HA config itself. A settings.py shim re-exports core.settings so the integration keeps its shim-only import convention. Tests: an AST scan asserts no core module imports homeassistant or accesses hass.config / entry.options / entry.data; a from_options test covers defaults-when-absent and rejection of invalid horizon/rollover; a materialization test drives a non-default horizon (3 days, 03:30 rollover) and asserts the resulting instance window matches.
14 lines
530 B
Python
14 lines
530 B
Python
"""Re-export of :mod:`custom_components.nestquest.core.settings` for the integration package.
|
|
|
|
The explicit, Home-Assistant-free settings object lives in
|
|
:mod:`custom_components.nestquest.core.settings` (introduced in task
|
|
4dd8f870); this module re-exports it so the integration constructs the
|
|
settings object from ``entry.options`` and threads it into the core
|
|
paths without core ever reading HA config itself.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from .core.settings import NestQuestSettings
|
|
|
|
__all__ = ["NestQuestSettings"]
|