Home Assistant automation ideas

Supercharge Your Smart Home: 5 Practical Home Assistant Automation Ideas

Home Assistant isn’t just a dashboard for your devices—it’s the brain of a truly intelligent, responsive, and effortless home. Turning on a light with an app is convenient. However, automations transform your house from a collection of connected gadgets into a living ecosystem. This ecosystem anticipates your needs. This post explores five powerful and practical automation ideas. It provides YAML examples to help you move beyond the basics. You can create a smart home that truly works for you.

Advertisements

1. Circadian Lighting: Sync Your Lights with the Sun

The Problem: Static, harsh white light throughout the day disrupts our natural circadian rhythm, affecting sleep and energy. Manually adjusting color temperature and brightness is tedious.

The Solution: Automatically shift your lights’ color temperature (Kelvin) and brightness. This adjustment mimics the natural progression of daylight. Lights transition from a cool, energizing blue-white in the morning to a warm, relaxing amber in the evening.

How it Works: This automation uses the sun.sun entity’s elevation to decide the time of day and adjusts a light group (or individual lights) accordingly. It’s typically set to run on a time_pattern every 15-30 minutes.

alias: "Circadian Lighting - Living Room"
trigger:
  - platform: time_pattern
    minutes: "/15"  # Runs every 15 minutes
condition:
  - condition: state
    entity_id: group.living_room_lights
    state: "on"  # Only adjust if lights are on
action:
  - choose:
      # Sunrise to Midday (Cool, bright)
      - conditions:
          - condition: numeric_state
            entity_id: sun.sun
            attribute: elevation
            above: 0
        sequence:
          - service: light.turn_on
            target:
              entity_id: group.living_room_lights
            data:
              color_temp_kelvin: 5000  # Cool daylight
              brightness_pct: 100

      # Midday to Sunset (Slightly warmer, still bright)
      - conditions:
          - condition: numeric_state
            entity_id: sun.sun
            attribute: elevation
            above: 15
        sequence:
          - service: light.turn_on
            target:
              entity_id: group.living_room_lights
            data:
              color_temp_kelvin: 4000  # Neutral white
              brightness_pct: 100

      # Sunset to Nautical Twilight (Warm, dimming)
      - conditions:
          - condition: numeric_state
            entity_id: sun.sun
            attribute: elevation
            above: -6
        sequence:
          - service: light.turn_on
            target:
              entity_id: group.living_room_lights
            data:
              color_temp_kelvin: 3000  # Warm white
              brightness_pct: 75

      # Night (Very warm, very dim)
      - conditions:
          - condition: numeric_state
            entity_id: sun.sun
            attribute: elevation
            below: -6
        sequence:
          - service: light.turn_on
            target:
              entity_id: group.living_room_lights
            data:
              color_temp_kelvin: 2700  # Soft amber
              brightness_pct: 30
    default: []
mode: restart  # Restart if a new trigger occurs while running

Tip: Use the Adaptive Lighting integration (add-on) for a more robust version of this. It provides a feature-rich experience with smooth transitions and per-light customization.


2. Smart Motion Lighting with Occupancy Awareness

The Problem: Motion sensors turn lights on. They often turn off while someone is still in the room if they’re momentarily still. Alternatively, they stay on forever after the motion stops. This wastes energy and creates inconvenience.

The Solution: A “vacancy timer” resets with every motion detection. It also uses a presence sensor (like a Bluetooth tracker). A router device tracker or a camera-based occupancy sensor can override the timer. If a person is still detected in the room, the lights stay on, even without motion.

alias: "Motion Light - Hallway (with Presence Hold)"
trigger:
  - platform: state
    entity_id: binary_sensor.hallway_motion
    to: "on"
  - platform: state
    entity_id: binary_sensor.hallway_occupancy  # e.g., from a camera or multi-sensor
    to: "on"
condition:
  - condition: state
    entity_id: light.hallway
    state: "off"  # Only run if lights are currently off
action:
  - service: light.turn_on
    target:
      entity_id: light.hallway
    data:
      brightness_pct: 75
  - delay:
      minutes: 5  # Start a 5-minute vacancy timer
  - while:
      - condition: state
        entity_id: binary_sensor.hallway_occupancy
        state: "off"
    sequence:
      - delay:
          seconds: 1
      - condition: state
        entity_id: binary_sensor.hallway_motion
        state: "off"
    timeout:
      minutes: 5
  - service: light.turn_off
    target:
      entity_id: light.hallway
mode: restart  # Restart the whole sequence on new motion

Tip: For the binary_sensor.hallway_occupancy, consider using the occupancy sensor from a Reolink camera with the reolink integration, or a device_tracker for a phone that’s only “home” in that specific room via zone.


3. Vacation Mode: Simulated Presence with Randomness

The Problem: Simple “turn lights on at 7 PM” schedules are predictable and easily spotted by potential intruders. True presence involves varied activity in different rooms at different times.

The Solution: An automation suite activates through “Vacation Mode” via an input_boolean. It randomly triggers lights, media players, and even blinds. These actions occur in different zones throughout the evening to mimic genuine human activity.

# First, a helper to toggle vacation mode
input_boolean:
  vacation_mode:
    name: Vacation Mode
    initial: off

# The main automation (simplified example for one room)
alias: "Vacation Simulation - Living Room"
trigger:
  - platform: event
    event_type: homeassistant_start  # Ensures it runs after restart
  - platform: state
    entity_id: input_boolean.vacation_mode
    to: "on"
condition:
  - condition: state
    entity_id: input_boolean.vacation_mode
    state: "on"
  - condition: time
    after: "18:00:00"
    before: "23:00:00"
action:
  - variables:
      # Generate a random start time within a 3-hour window and a random duration
      random_start: "{{ (range(18*60, 21*60) | random) | timestamp_custom('%H:%M', false) }}"
      random_duration: "{{ range(30, 120) | random }}"
  - delay:
      # Wait until the calculated random start time (from now)
      "{{ (as_timestamp(now()) + (strptime(random_start, '%H:%M') - now()).total_seconds()) | timestamp_custom(%) }}"
  - service: light.turn_on
    target:
      entity_id: light.living_room_lamp
    data:
      brightness_pct: 60
  - delay:
      minutes: "{{ random_duration }}"
  - service: light.turn_off
    target:
      entity_id: light.living_room_lamp
mode: single

Tip: Create multiple similar automations for different rooms (bedroomkitchenoffice) with different time windows (e.g., kitchen activity earlier, bedroom later) for maximum realism.


4. Adaptive Environmental Comfort (Thermostat & Humidifier)

The Problem: A fixed thermostat setting ignores humidity and outdoor conditions. 22°C at 30% humidity feels very different than 22°C at 60% humidity. Manual adjustments are constant.

The Solution: Use temperature and humidity sensors. Combine these with a weather forecast. Dynamically adjust your thermostat’s target_temp_low (for cooling). Turn on or off a humidifier or dehumidifier to maintain a calculated “feels-like” comfort range.

alias: "Adaptive Climate Control - Bedroom"
trigger:
  - platform: state
    entity_id:
      - sensor bedroom_temperature
      - sensor bedroom_humidity
      - sensor.weather_home_temperature  # From your weather integration
condition:
  - condition: numeric_state
    entity_id: sensor.bedroom_temperature
    above: 18  # Only run if temp is above a minimum
action:
  - variables:
      # Simple comfort index: temp + (humidity / 10)
      comfort_index: "{{ states('sensor.bedroom_temperature') | float + (states('sensor.bedroom_humidity') | float / 10) }}"
      target_index: 22.5  # Your desired "feels-like" temperature
  - choose:
      # If it feels too warm AND outdoor temp is comfortable, cool the room
      - conditions:
          - condition: numeric_state
            value_template: "{{ comfort_index > target_index + 1.5 }}"
          - condition: numeric_state
            entity_id: sensor.weather_home_temperature
            below: 22
        sequence:
          - service: climate.set_temperature
            target:
              entity_id: climate.bedroom_ac
            data:
              temperature: "{{ (states('climate.bedroom_ac').attributes.temperature) - 1 }}"  # Lower by 1 degree
          - service: switch.turn_off
            target:
              entity_id: switch.bedroom_humidifier

      # If it feels too cool AND humidity is low, use humidifier (warm mist increases perceived temp)
      - conditions:
          - condition: numeric_state
            value_template: "{{ comfort_index < target_index - 1.5 }}"
          - condition: numeric_state
            entity_id: sensor.bedroom_humidity
            below: 40
        sequence:
          - service: switch.turn_on
            target:
              entity_id: switch.bedroom_humidifier
    default: []  # Do nothing if within comfort range
mode: restart

Tip: This is a starting point—tune the target_index, thresholds (+/- 1.5), and logic (e.g., add a check to not run AC if outdoor temp is higher) for your specific climate and HVAC system.


5. Integrated “Good Night” Routine with Conditional Steps

The Problem: A bedtime button or voice command shouldn’t just turn off lights. It should handle final checks (locks, garage), prepare for the next day (thermostat, robot vacuum), and adapt based on context (e.g., “I’m just watching a movie” vs. “I’m going to sleep”).

The Solution: A single automation is triggered by a input_button or voice command. It uses choose conditions to perform a sequence of actions. Some steps are conditional on other sensor states.

alias: "Routine - Good Night"
trigger:
  - platform: state
    entity_id: input_button.good_night
    to: "on"
  # Or for voice: - platform: intent
  #   intent: GoodNightIntent
action:
  - service: notify.mobile_app_yourphone
    data:
      message: "Good night routine started."
  - choose:
      # Step 1: Secure the home (always)
      - conditions: []
        sequence:
          - service: lock.lock
            target:
              entity_id: lock.front_door, lock.back_door
          - service: cover.close_cover
            target:
              entity_id: cover.garage_door
          - service: switch.turn_off
            target:
              entity_id: switch.all_outdoor_lights

      # Step 2: Adjust climate based on season (using a helper input_select)
      - conditions:
          - condition: state
            entity_id: input_select.season
            state: "Winter"
        sequence:
          - service: climate.set_temperature
            target:
              entity_id: climate.home
            data:
              temperature: 20  # Cooler for sleeping
      - conditions:
          - condition: state
            entity_id: input_select.season
            state: "Summer"
        sequence:
          - service: climate.set_temperature
            target:
              entity_id: climate.home
            data:
              temperature: 23  # Warmer for sleeping

      # Step 3: Final lights & media (only if in living room)
      - conditions:
          - condition: state
            entity_id: media_player.living_room_tv
            state: "playing"
        sequence:
          - service: media_player.turn_off
            target:
              entity_id: media_player.living_room_tv
          - service: light.turn_off
            target:
              entity_id: group.living_room_lights
          - service: light.turn_on
            target:
              entity_id: light.bedroom_nightlight
            data:
              brightness_pct: 5
    default: []
  - service: input_button.turn_off
    target:
      entity_id: input_button.good_night
mode: single

Tip: Use scripts for complex, multi-step routines like this. The automation above simply calls a script.good_night which contains the choose logic. This makes the trigger simpler and the routine callable from other places (like a dashboard button).


Conclusion: Start Simple, Iterate, and Personalize

The magic of Home Assistant automations isn’t in their complexity, but in their relevance to your life. The examples above provide robust templates, but their true power is unlocked when you tailor them. Start with one: perhaps the motion lighting in a hallway or the circadian rhythm in your bedroom. Implement it, test it for a week, and tweak the thresholds (brightness_pctdelay minutes, comfort target_index).

Remember the pillars of a great automation:

  1. Clear Trigger: What starts it? (Time, motion, state change, command).
  2. Smart Condition: When should it run? (Only if lights are off, only in summer, only when someone is home).
  3. Action(s): What happens? Can it be a sequence? Use choose for branching logic.
  4. Mode: How does it handle new triggers? (restart for timers, single for one-off scenes).

Use the Automation Editor UI in Home Assistant to build the initial structure. Then, switch to YAML for advanced templates and variables. Engage with the incredible Home Assistant community—the forums and subreddit are treasure troves of specific use cases and troubleshooting help.

Your smart home should fade into the background, a silent, efficient partner. By implementing thoughtful automations like these, you’re not just controlling devices. You’re programming peace of mind, efficiency, and a touch of everyday magic. Now, go automate.


Some of the links in this article are "affiliate links", a link with a special tracking code. This means if you click on an affiliate link and purchase the item, we will receive an affiliate commission. The price of the item is the same whether it is an affiliate link or not. Regardless, we only recommend products or services we believe will add value to our readers. By using the affiliate links, you are helping support our Website, and we genuinely appreciate your support.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.