Once more than a handful of automations touch the same lights, speakers or notifications, they begin to fight, politely, in milliseconds, and entirely behind your back. The failure is not dramatic: an alert colour gets overwritten a second after it appears, a restored scene clobbers an alarm, an ambience feature blinks a lamp during an emergency. Each automation is individually correct.
The lamp in the living room is wanted by a great many automations, each of which has an excellent reason, and none of which had been introduced to the others. The result, before arbitration, was a light that flickered between opinions like a committee.
Snapshot, take over, restore
When an alarm needs the lights, it should not simply switch them on, it should record what they were doing, take control, and hand them back afterwards.
on alarm: snapshot current light states → take over
on alarm end: restore the snapshot
Two refinements make it survive contact with reality. First, restoring must be condition-aware: if the situation changed while the alarm was running (someone came home, night fell) blindly restoring a stale snapshot is worse than leaving things be. Second, the snapshot must be cleaned up, or a later restore will apply a scene from hours ago, snapping the house back to a sunny afternoon that is no longer occurring.
Gate on the specific state, not the general one
A subtle one worth stealing. Suppose colour alerts on lamps must not fire while the alarm is sounding. The obvious gate is "alarm system is armed", but that suppresses alerts for the entire time you are away, which is exactly when you most want to know about a leak.
The correct gate is the narrow one: not while actually triggered. Armed is a normal operating state; triggered is the exclusive one. Gating on the broad state is a common way to accidentally disable half your safety net.
Suppression with a quieter substitute
When a known activity will legitimately trip an air-quality alert, silencing the alert outright loses information. A better shape: suppress the loud path, substitute a discreet one.
So a detected indoor activity suppresses the dramatic red-light alert (which would be both obvious and useless, since you already know why the air changed) but still sends a quiet "maybe open a window" nudge. The system stays useful without being theatrical.
Give ambience the lowest priority
Anything decorative must yield to anything functional, and it must do so automatically. The rules that work well:
- Only touch devices that are currently off, never interrupt something in use.
- Stand down entirely while any alert is active.
- Turn yourself off when nobody is home. Ambience for an empty room is just wear.
- Clear leftover state at a fixed hour, so a stuck decorative state cannot persist for days.
Make suppression states self-clearing
Every "do not alert right now" flag is a small time bomb: if it can be set and not cleared, you will eventually have a permanently muted alarm and no indication of it. Give each one at least two independent off-paths, the natural end condition, and a timeout, and make the timeout restart-proof. A flag that only clears on a condition that may never recur is a silent failure waiting for its moment.
One event, several audiences
The same physical event often deserves different treatment depending on who is present and what else is true. A draught while cooling costs money; a draught while the place is stuffy is exactly what you wanted. An empty home wants an alarm; an occupied one wants a nudge. Resist writing two automations that both watch the same sensor, write one that knows the context, or they will eventually contradict each other, politely, at machine speed, like two butlers who each straighten the same painting on the way past, forever.
The committee still exists. It just has a chair now, and the chair has a list.