Build whole-home Home Assistant routines an agent can trust: automations and scripts with safety confirmations before risky actions, presence-aware logic, and failure fallbacks that keep the house sane when devices flake. Use when creating or reviewing HA automations and scripts, gating a risky action behind human approval, making behavior depend on who is home, or hardening a routine against flaky devices and missed responses.
./install.sh home-assistant-routinesname: home_assistant_routines description: Build whole-home Home Assistant routines an agent can trust: automations and scripts with safety confirmations before risky actions, presence-aware logic, and failure fallbacks that keep the house sane when devices flake. Use when creating or reviewing HA automations and scripts, gating a risky action behind human approval, making behavior depend on who is home, or hardening a routine against flaky devices and missed responses.
Thin per-device automations pile up into a mess that misfires at 2 AM. A routine is a whole-home job designed end to end: what starts it, what must be true, what it asks before acting, what it does when nobody answers, and what it does when a device fails.
This skill turns a plain request ("arm the house when everyone leaves") into a routine that:
It covers automations (triggered, with conditions) and scripts (started on demand, no triggers). Both use the same actions and building blocks: choose, if/then, wait_for_trigger, wait_template, repeat, delay, parallel. Verified against the official HA docs and the companion app docs; links in references/sources.md.
Follow these steps in order. Do not skip the safety steps.
One verb, one outcome, one trigger moment. "When everyone leaves, ask whether to arm the alarm, then arm it or leave it." If you cannot state it in one sentence, the routine is two routines.
person or zone over raw device trackers.choose.Any step that is risky, hard to undo, or security-relevant gets a human gate first. The proven pattern is the confirmable notification script (details and full YAML in references/confirmations.md):
action_arm: "{{ 'ARM_' ~ context.id }}". Never reuse a fixed ID across runs; stale taps from an old notification would fire the wrong run.actions: (Confirm / Dismiss buttons).wait_for_trigger on platform: event, event_type: mobile_app_notification_action, matching your unique action IDs. Set a timeout. Never wait forever; a phone on silent is a normal state.choose on wait.trigger.event.data.action to run the confirmed step, the dismissed step, or the timeout fallback.single blocks re-runs while waiting; restart kills the old wait when re-triggered; parallel and queued let runs stack. The timeout keeps any mode from wedging.Gate behavior on person.* entities and zone states (home, away, not_home), not on single device trackers. Details in references/presence.md:
for: delay (a few minutes) so a tracker blip at the driveway does not arm the house while someone is still in the garage.away as proof someone left; trackers lie, groups of them lie less.Assume every step can fail. Details and patterns in references/fallbacks.md:
continue_on_error: true on steps allowed to fail (a notification to a dead service, one light in a group). By default a failed step stops the whole run and marks it failed; use this to keep the rest alive. It does not hide the error; traces and logs still record it.wait_for_trigger and wait_template, with a fallback branch for the timeout case. A routine with no timeout is a routine that wedges.repeat with until for critical alerts that must not be missed once (water leak, smoke, freezer). Retry with backoff, and cap it with a final fallback (call a second device, log a persistent notification).default branch on every choose that needs one. Silence is not a plan.is_state or availability first, or the step fails at 3 AM and wakes nobody.Every routine this skill produces ships with:
for: delays against tracker noise.continue_on_error, where waits time out, what the fallbacks are.wait_for_trigger and wait_template gets a timeout and a fallback branch.context.id.for: delays against flapping.continue_on_error is for steps the routine can survive losing, never for the safety-critical step itself. If the lock command fails, the routine must fail loudly, not shrug and continue.publisher key 2e43c913833850e6d80f939677e3de76e806d47785c0f1caaca90f9d18c98e1e
No ratings yet — be the first to rate it.