What do you need before you start?
- Two or three lights Home Assistant can control. Smart bulbs or plug-in lamps on smart plugs both work. Pick lamps that can be seen from the street, such as the living room and a bedroom. Our best smart bulbs for the UK roundup covers options if you are buying.
- A toggle helper. Home Assistant's
input_booleanstores an on or off state you set yourself. You create it in Settings > Devices & services > Helpers > Create helper > Toggle. The Home Assistant helpers guide explains the other helper types. - A phone running the Home Assistant app with location tracking, if you want holiday mode to switch on by itself. See Home Assistant presence detection for setup.
- Entity IDs for your lights. Find them under Settings > Devices & services > Entities. The examples below use
light.living_room_lampandlight.bedroom_lamp; swap in your own.
Step 1: Create the holiday mode toggle
Create a Toggle helper named Holiday mode. Home Assistant gives it the entity ID input_boolean.holiday_mode. In the helper's More options you can choose its startup state; the default restores whatever it was before a restart, which is what you want so a reboot mid-holiday does not silently end the simulation.
Every automation below checks this one switch. Turning it on starts the routine, turning it off stops it, and you can flip it from the dashboard or the phone app from anywhere.
Step 2: Turn the living room lamp on around sunset, at a random time
Create a new automation, switch to YAML mode and paste this. It triggers 45 minutes before sunset, then waits a random 0 to 30 minutes before switching the lamp on, so the time drifts every evening.
alias: "Holiday mode - evening lamp on"
mode: single
triggers:
- trigger: sun
event: sunset
offset: "-00:45:00"
conditions:
- condition: state
entity_id: input_boolean.holiday_mode
state: "on"
actions:
- delay:
seconds: "{{ (range(0, 30) | random) * 60 }}"
- action: light.turn_on
target:
entity_id: light.living_room_lamp
data:
brightness_pct: 70
kelvin: 2700
Home Assistant's sun trigger takes an offset in seconds or hh:mm:ss, where a negative value fires before the event. The delay field accepts a template, so the random number is worked out fresh on every run. On a UK winter evening sunset can be before 4pm, so the lamp may come on while it is still light outside; if that bothers you, add a sun condition for after: sunset with a negative offset, or trigger on a fixed time instead.
Step 3: Turn the lamps off at a random time late in the evening
A lamp that always goes off at exactly 22:30 is as obvious as a plain timer. This second automation starts at 22:15 and waits up to 75 minutes before switching off the living room lamp, then does the bedroom lamp on its own separate delay.
alias: "Holiday mode - evening lights off"
mode: single
triggers:
- trigger: time
at: "22:15:00"
conditions:
- condition: state
entity_id: input_boolean.holiday_mode
state: "on"
actions:
- delay:
seconds: "{{ (range(0, 75) | random) * 60 }}"
- action: light.turn_off
target:
entity_id: light.living_room_lamp
- delay:
seconds: "{{ (range(5, 40) | random) * 60 }}"
- action: light.turn_off
target:
entity_id: light.bedroom_lamp
The Home Assistant docs describe four automation modes: single (the default) ignores a new start while a run is active, restart stops the current run and begins again, queued lines runs up, and parallel starts each one immediately. single is right here, because you never want two overlapping runs fighting over the same lamp.
Step 4: Add a second lamp and a bedroom routine
One lamp that switches on and off is better than nothing, but a convincing pattern moves around the house. Copy the evening-on automation and change three things: the entity to light.bedroom_lamp, the trigger to a time such as "21:00:00", and the delay range to something different, such as 0 to 20 minutes. Now the living room lights first, the bedroom follows an hour or so later, and the order they switch off in differs too.
For a hallway or landing, a dim level of 20 to 30 per cent for the last half hour reads as someone heading to bed. If you already have a motion-triggered night light, our motion-activated night light guide shows the same dimming approach; just make sure holiday mode does not leave that automation reacting to a cat.
Step 5: Switch holiday mode on automatically when everyone has left
You can flip the toggle by hand, but forgetting is the usual failure. Home Assistant exposes a zone.home entity whose state is the number of people currently in the home zone. When it has read 0 for 24 hours, nobody has been home for a day, which is a reasonable signal that you are away rather than just out.
alias: "Holiday mode - switch on when away 24 hours"
mode: single
triggers:
- trigger: state
entity_id: zone.home
to: "0"
for: "24:00:00"
actions:
- action: input_boolean.turn_on
target:
entity_id: input_boolean.holiday_mode
- action: notify.mobile_app_your_phone
data:
message: "Holiday mode is on. Lights will mimic someone being home."
Pair it with a second automation that turns input_boolean.holiday_mode off when zone.home goes above zero, so the simulation stops as soon as the first person gets back. The notify action name depends on your device; the Home Assistant notifications guide shows how to find it.
Step 6: Test it before you leave
Turn Holiday mode on, then open each automation and choose Run actions from the three-dot menu, which skips the trigger and runs the steps. Check the lamps respond and the delay does not stall. Then open Settings > Automations & scenes, pick an automation and view its traces to confirm each ran through the condition and the random delay.
Do a full dress rehearsal the evening before you go: switch holiday mode on while you are home and watch the street-facing windows from outside. A lamp that is hidden behind curtains or only visible from the back of the house is not helping.
Is there a ready-made presence simulation add-on?
Yes: a community HACS integration called Presence Simulation replays your own history instead. It reads the Home Assistant recorder for the states of lights and other entities from a set number of days earlier (the delta) and applies them again, with an optional random offset of a few seconds on each switch time. It supports lights, covers, media players and anything controllable on or off, adds a switch entity you toggle to start and stop it, and its README notes you need the recorder to retain more days of data than your delta, with 10 days the default.
| Approach | Setup effort | How realistic | Main weakness |
|---|---|---|---|
| Fixed timer on a smart plug | Minutes | Low: same time every night | Predictable to anyone watching |
| Randomised automations (this guide) | About 30 minutes | Medium to high: shifting times, several rooms | You design the pattern by hand |
| Presence Simulation (HACS) | About 15 minutes | High: copies your own routine | Needs recorder history; lights lose brightness and colour replay without a companion component |
The hand-built route is easier to understand and debug, and it does not depend on a third-party component surviving a Home Assistant update. The history replay is more lifelike if you have a settled routine and recorder data to copy. Note that the README does not state a support policy, so treat it as a community project.
What else makes an empty house look occupied?
Lights are only part of it. Havering Council's crime prevention advice warns against leaving daytime curtains closed, since that signals an empty home, and suggests cancelling milk and online deliveries. It also warns that a timed light paired with a table lamp visible through a window can be a giveaway. Several forces, including Hertfordshire, advise against posting holiday dates on social media.
Smart home gear can cover some of these: a smart blind or curtain motor can open in the morning, and a camera or doorbell can alert you to visitors. If you want to go further, our home security guide and best home security systems roundup cover alarms and cameras.
Why isn't my holiday mode automation running?
The lamp never switches on: check that input_boolean.holiday_mode is actually on when the trigger fires. The condition silently stops the run otherwise, and the trace will show it stopped at the condition.
The automation fires but the delay never ends: a restart or reload cancels a running delay. If you reload automations during the evening, the pending off step is lost. Reload before the trigger time, or use a final "all off" automation at 01:00 as a safety net.
The template errors out: the delay value must evaluate to a number. Keep the template in quotes and test it in Developer tools > Template before saving.
Holiday mode switches on while you are home: zone.home depends on phone location reporting. If the app's location permission is restricted, the state can read 0 even though you are in. Check the companion app's location setting and make sure at least one reliable tracker is configured.
The lamp stays on all night after a power cut: a smart plug may come back on at power restore. Set the plug's power-on behaviour to off in its own settings where the device offers it.





