A dark house after sunset is a signal. A living-room lamp that always slams on at 19:00:00 is another. This workflow runs only while an away helper is on and the sun is down: it picks lights from a list, turns them on and off inside time windows you set, waits a random delay between each step, and kills the whole set at an end time so nothing is still burning at 2 a.m.
Entity ids are blueprint inputs. Do not publish which rooms you normally occupy, or a nightly schedule from a real household.
This is occupancy theater, not a replay of last week’s lights. If you already drive rooms from BLE room presence, keep that pack off while away is on (or give it the same override helper) so the two do not fight.
What problem it solves
You want interior lights to look lived-in while the house is empty after dark — random enough that a watcher does not see a loop, bounded enough that the set is dark again at a time you choose.
How it works
- Gate —
input_boolean.away(or a zone-empty binary) ison, and sun is below the horizon (or below a small elevation offset). Either condition false → the automation does nothing and will not start a new cycle. - Windows — one or more evening windows (for example dusk–21:00, 21:00–end). Each window has a light list, a minimum and maximum on-duration, and a random delay before the first on so every night starts a different minute.
- On, wait, off — pick the next light (shuffle or a fixed order with a jittered delay between fixtures).
light.turn_onwith an optional brightness,delaya random duration in the min/max range, thenlight.turn_off. Repeat until the window ends. - End time — a time trigger (pack default late evening) turns off every light in the combined list, cancels leftover delays, and stops. Morning does not restart unless away is still on and the next sunset arrives.
- Override —
input_boolean.away_lighting_holdskips the script (guest, sitter, you came home and forgot the away helper). Turning away off mid-cycle also cancels and leaves lights as they are; it does not force an off, so a person walking in is not dropped into the dark.
Do not point this at exterior floods or a porch lamp you already use as a “we are out” marker. Interior only.
Hardware notes
- Lights. Any HA
lightor switch-as-light. A group entity is fine for a room; the pack still wants a list so it can stagger members instead of slamming the group at once. - Away signal. A helper you flip, or a template on “no device_tracker in zone.home.” Do not publish tracker names. Phone-based presence is enough; you do not need mmWave for theater.
- No extra hardware. If the lights already toggle from the app, this is YAML and two helpers.
- Brightness. Dim evening values look more plausible than 100%. The pack substitutions include a brightness input; skip it for dumb switches.
Snippet
The pack ships a blueprint. Inputs replace real entity ids:
trigger:
- platform: sun
event: sunset
offset: !input sunset_offset
id: dusk
- platform: time
at: !input end_time
id: lights_out
condition:
- condition: state
entity_id: !input away_helper
state: "on"
- condition: state
entity_id: !input hold_helper
state: "off"
action:
- choose:
- conditions:
- condition: trigger
id: dusk
sequence:
- delay:
minutes: "{{ range(min_delay, max_delay + 1) | random }}"
- service: light.turn_on
target:
entity_id: !input interior_lights
# shuffle / per-light delays + window loop: full blueprint in the pack
- conditions:
- condition: trigger
id: lights_out
sequence:
- service: light.turn_off
target:
entity_id: !input interior_lights
Setup outline
- Create
input_boolean.awayandinput_boolean.away_lighting_hold. Make a group or list of interior lights only. - Import the blueprint. Fill away / hold helpers, light list, sunset offset, window min/max on times, end time, optional brightness.
- Flip away on before sunset (or set the sun offset to “now” on a bench). Confirm: nothing happens while away is off; after sunset a light comes on after a delay; end time clears the set.
- Walk a real evening once with away on. If two lights slam together, raise the inter-light delay. If a presence pack also owns those lights, point it at the same hold helper.
Troubleshooting
- Lights never start. Away is off, hold is on, or you triggered from a time that is still before sunset in HA’s timezone. Check sun.sun and the away helper in Developer Tools, not the phone clock.
- Same sequence every night. You used a fixed ordered list with a zero jitter. Enable shuffle or raise
min_delay/max_delayso the first on is not the same minute. - Still on at midnight. End-time trigger never ran (automation disabled after dusk) or a different automation turned the light back on. The pack’s end step must stay enabled; bind hold if a motion pack should take over when someone is actually home.
- Came home to a dark room mid-cycle. You turned away off (correct — we do not force off) but nothing else turned the room on. Flip hold and let your normal presence / wall-switch automations run.
Credits
Based on Blacky’s community blueprint Holiday & Away Lighting. This write-up is an original overview of the away-gated, sunset-to-end-time random lighting pattern.