Document the automation package and test event validity

README gains the blueprint section: all four blueprints, their
inputs, the wiring table to the options-flow notification settings,
the celebration helper setup, event/sensor payload reference, and a
copy-pasteable example package. Tests assert every event trigger
references a real NestQuest event and no reminder is produced for an
absent child.
This commit is contained in:
2026-09-19 14:52:12 -04:00
parent 5092369d49
commit 3a2e6faa69
3 changed files with 135 additions and 1 deletions
+25 -1
View File
@@ -241,4 +241,28 @@ def test_afternoon_reminder_never_hard_codes_notify_target() -> None:
assert re.search(r"notify\.[a-z_]+", target_description), (
"the input description should show a placeholder example"
)
assert single_action(bp)["action"] == BlueprintInput("notify_target")
assert single_action(bp)["action"] == BlueprintInput("notify_target")
def test_afternoon_reminder_absent_child_regression() -> None:
"""The Feature 11 guardrail, stated as one regression test: no
reminder message is ever produced for an absent child."""
states = make_states(
sensors=[
TemplateState(
"sensor.nestquest_bob_quests_due_today",
"3",
{"child_name": "Bob", "child_id": 1, "present": False},
),
TemplateState(
"sensor.nestquest_bob_quests_remaining_today",
"3",
{"child_id": 1},
),
],
)
guard = afternoon_conditions(afternoon_reminder())[-1]
assert render(guard["value_template"], states=states).strip() == "False"
message = render(
notify_data(afternoon_reminder())["message"], states=states
)
assert "Bob" not in message
+22
View File
@@ -272,3 +272,25 @@ def test_celebration_mode_is_queued() -> None:
"""Two children completing at nearly the same time must both be
processed: queued mode does not drop the second event."""
assert celebration()["mode"] == "queued"
def test_every_blueprint_event_reference_is_real() -> None:
"""Every event a blueprint triggers on is one NestQuest actually
fires or defines (Feature 10/11) — no invented event names."""
from tests.blueprint_helpers import load_blueprints
real_events = {
"nestquest_quest_completed",
"nestquest_quest_uncompleted",
"nestquest_quest_missed",
"nestquest_child_day_complete",
}
for name, bp in load_blueprints().items():
for trigger in bp.get("triggers", []):
if trigger.get("trigger") == "event":
assert trigger["event_type"] in real_events, (
f"{name}: invented event {trigger['event_type']!r}"
)
assert celebration()["triggers"][0]["event_type"] == (
"nestquest_child_day_complete"
)