Skip to content

Lighting: one blueprint, per-room packages

Architecture: packages/rooms/<room>.yaml (light group + approach group + presence group + timers + AL + blueprint instance), one shared state-machine blueprint, house-wide packages for cross-room policy.

State machine (blueprints/automation/fmm/room_lights.yaml): - approach ON → lights on, IF: not paused, target lights off, presence clear ≥15s OR fresh <15s (the arriving person — see war story on the own-motion race), gate door open. - presence ON → cancel timeout, clear manual hold. - both clear → 5-min timer → off (targets the All group; on_group lets turn-on hit only Primary lights). - manual-on in an empty room → hold until presence visits or lights go off. - bathroom hold-door rule; unavailable interior motion counts as occupied.

Key patterns: - Door pulses (packages/house/door_pulses.yaml): trigger-template binary sensors, 30s auto_off, from: "off" REQUIRED (restart flaps fake openings). Doors feed approach groups as events, never as levels. - Sleep policy (packages/house/sleep_mode.yaml): evaluated when a room's lights turn OFF (00:00–08:00 window → sleep on; else off), plus window- boundary sweeps for rooms already dark. Bedrooms are never auto-slept. 2s settle delay before flipping sleep (fade-out race made lights flash). - Light tiers: rooms can define lights_primary / lights_decorative under lights_all (nested HA groups); automations turn ON primary, OFF all. - Special rooms: Entry = always-on; Laundry = pure door-follow; bedrooms = manual-only by preference.