Home Assistant Guide

Simple tutorials for powerful automations

Vacation Mode (Blueprint): Simulate Occupancy with Random Lights and Devices in Home Assistant

Want your home to look lived-in while you’re away? This Vacation Mode blueprint for Home Assistant randomly turns selected lights and switches on and off during the evening window you choose. It staggers start times, shuffles device order, and varies how long each device stays on—so it looks like real people are moving around, not a script.

What Does This Blueprint Do?

  • Randomly turns your chosen light and/or switch entities on and off between your start and end times each evening
  • Keeps each device on for a random duration between your Min/Max limits
  • Shuffles the activation order so the pattern changes every night
  • Optionally staggers the first start time so everything doesn’t turn on at once
  • Runs automatically only when your “Vacation Mode” switch is ON

Result: It looks like someone’s home—even when you’re on the beach.

Requirements

  • Home Assistant (any install)
  • At least one controllable light or switch entity
  • An input_boolean to act as the Vacation Mode toggle (e.g., input_boolean.vacation_mode)

How to Use This Blueprint

Note: This is a blueprint. You’ll import it once, then create one or more automations from it.

  1. Import the Blueprint
    Click the Import Blueprint button/link at the top of this article.
    — When Home Assistant opens, review the YAML preview and click Import.
    Alternative (manual): In Home Assistant, go to Settings > Automations & Scenes > Blueprints, click Import Blueprint, paste the blueprint’s raw YAML URL, then Preview > Import.
  2. Create an Automation from the Blueprint
    Go to Settings > Automations & Scenes > Blueprints, find “Vacation Mode: Random Lights/Devices”, and click Create Automation.
  3. Fill in the Inputs
    • Vacation Mode Switch: Choose the input_boolean that enables/disables vacation mode (e.g., input_boolean.vacation_mode).
    • Lights / Switches: Select one or more light and/or switch entities to randomize.
    • Evening Window: Set Earliest Start and Latest End (e.g., 18:00 → 23:00).
    • On-Time Range: Minimum and maximum minutes each device should stay on (e.g., 10 → 45 min).
    • Stagger Start (optional): Add a random delay before the first device starts to avoid a “lights-on-all-at-once” look.
    • Daily Max Toggles (optional): Cap how many times each device can be toggled per evening (to protect bulbs or avoid odd patterns).
    • Safety Off at End (recommended): Force all selected entities to off at the end time.
  4. Save
    Click Save. Turn ON your Vacation Mode switch to activate; turn it OFF to stop.

Tip: You can also toggle Vacation Mode automatically—for example, when everyone leaves home, or when your alarm is set to “Away.”

Configuration Options

  • Vacation Mode Switch: input_boolean used to enable/disable the effect
  • Lights/Devices: Any number of light/switch entities
  • Earliest Start / Latest End: Randomization happens only inside this evening window
  • Min/Max On Time: Random duration boundaries for each “on” run
  • Stagger Start: Random initial delay to keep things natural
  • Daily Max Toggles: Optional per-device cap per night
  • Force Off at End: Ensures everything is off at end time

How It Works (Overview)

Each evening (while your Vacation Mode switch is ON), the automation picks a randomized sequence of your selected devices, turns them on for a random period within your min/max, turns them off, then moves on to the next device. It shuffles order nightly and respects your window and per-night limits. At the end time, it optionally forces everything off.

Use Cases & Ideas

  • Simulate evening activity in living rooms, bedrooms, hallways, or porch lights
  • Alternate between different plug-in lamps to mimic real patterns
  • Combine with other “away” automations (e.g., blinds, media, TV simulator)

Advanced tip: Create multiple automations from this blueprint with different device sets or time windows (e.g., weekdays vs weekends).

Troubleshooting

  • Nothing happens: Check that your input_boolean is ON and current time is within the window.
  • Devices don’t toggle: Verify entities are controllable (Developer Tools → States) and not blocked by other automations or manual schedules.
  • Patterns feel too regular: Increase your min/max on-time spread, enable stagger, and add more devices.
  • Lights left on overnight: Enable “Force Off at End.”

Blueprint YAML


blueprint:
  name: Vacation Mode for Lighting and Devices
  description: >
    Randomly turns selected lights or devices on/off during the evening to simulate occupancy while you are away. Perfect for making your house look lived-in!
  domain: automation
  input:
    vacation_mode_switch:
      name: Vacation Mode Switch
      description: The input_boolean that enables/disables vacation mode (e.g., input_boolean.vacation_mode).
      selector:
        entity:
          domain: input_boolean
    targets:
      name: Lights or Devices
      description: The lights, switches, or plugs to randomize while you are away.
      selector:
        target:
          entity:
            domain:
              - light
              - switch
    earliest_start_time:
      name: Earliest Start Time
      description: Earliest time to begin randomizing (e.g., 18:00).
      default: "18:00:00"
      selector:
        time: {}
    latest_end_time:
      name: Latest End Time
      description: Latest time to finish (e.g., 23:00).
      default: "23:00:00"
      selector:
        time: {}
    min_on_mins:
      name: Minimum On Time (minutes)
      description: The minimum amount of time a device stays on.
      default: 30
      selector:
        number:
          min: 5
          max: 120
          step: 1
          unit_of_measurement: minutes
          mode: slider
    max_on_mins:
      name: Maximum On Time (minutes)
      description: The maximum amount of time a device stays on.
      default: 75
      selector:
        number:
          min: 10
          max: 180
          step: 1
          unit_of_measurement: minutes
          mode: slider

mode: restart
max_exceeded: silent

trigger:
  - platform: state
    entity_id: !input vacation_mode_switch
    to: "on"
  - platform: time
    at: !input earliest_start_time
    # Ensures the randomization starts each evening

condition:
  - condition: state
    entity_id: !input vacation_mode_switch
    state: "on"

variables:
  targets: !input targets
  min_on: !input min_on_mins
  max_on: !input max_on_mins
  earliest: !input earliest_start_time
  latest: !input latest_end_time

action:
  - repeat:
      while:
        - condition: state
          entity_id: !input vacation_mode_switch
          state: "on"
        - condition: template
          value_template: >
            {{ now().strftime('%H:%M:%S') >= earliest and now().strftime('%H:%M:%S') < latest }}
      sequence:
        - choose:
            - conditions: "{{ targets.entity_id is iterable }}"
              sequence:
                - variables:
                    # Randomize the device order nightly
                    shuffled: >
                      {{ targets.entity_id | list | shuffle }}
                - repeat:
                    for_each: "{{ shuffled }}"
                    sequence:
                      - variables:
                          entity: "{{ repeat.item }}"
                          # Random on time (min/max)
                          on_mins: "{{ (range(min_on, max_on + 1) | random) }}"
                      - action:
                          service: homeassistant.turn_on
                          target:
                            entity_id: "{{ entity }}"
                      - delay:
                          minutes: "{{ on_mins }}"
                      - action:
                          service: homeassistant.turn_off
                          target:
                            entity_id: "{{ entity }}"
                      # Random off period before the next device
                      - delay:
                          minutes: "{{ (range(5, 30) | random) }}"
            # Fallback if only one device is selected
            - conditions: "{{ targets.entity_id is string }}"
              sequence:
                - variables:
                    entity: "{{ targets.entity_id }}"
                    on_mins: "{{ (range(min_on, max_on + 1) | random) }}"
                - action:
                    service: homeassistant.turn_on
                    target:
                      entity_id: "{{ entity }}"
                - delay:
                    minutes: "{{ on_mins }}"
                - action:
                    service: homeassistant.turn_off
                    target:
                      entity_id: "{{ entity }}"
                - delay:
                    minutes: "{{ (range(5, 30) | random) }}"
        # Pause a random interval before the next randomization cycle
        - delay:
            minutes: "{{ (range(10, 30) | random) }}"