This post may contain affiliate links. As an Amazon Associate we earn from qualifying purchases. Disclosure.

TL;DR

Basic automations in Home Assistant are easy. Building complex ones with conditions, scripts, and YAML blueprints takes practice. These guides show you how.

Quick take: Home Assistant's automation engine supports conditional logic, presence detection, weather triggers, and multi-step action sequences -- no subscription required. Blueprints from the Blueprint Exchange give you tested automation templates without writing YAML. Scripts are reusable action sequences; scenes restore saved device states. Complex automations use YAML, but the visual editor handles most common patterns without code.

Home Assistant's real power isn't the device integrations -- it's the automation engine. Once you've gotten comfortable with the basic UI and your devices are connected, advanced automations are where the platform separates itself from every commercial smart home system. No subscription required. No restrictions on what devices can trigger what actions. The only limit is what sensors and logic you're willing to configure.

This section is for users who've moved past basic on/off schedules and want automations that respond to actual context: presence, time, sensor state combinations, device history, and external data feeds like weather or calendar events. If you haven't gone through the Home Assistant setup guide yet, start there -- advanced automations require a properly configured base installation with backups, user accounts, and a working Zigbee or Z-Wave coordinator.

What Does Advanced Home Assistant Automation Actually Mean?

Most smart home users run simple automations: lights on at sunset, thermostat down at bedtime. These work and are worth setting up. Advanced automation is different in kind, not just complexity.

Advanced automations use conditional logic -- "when X happens AND condition Z is true AND it hasn't happened in the last 30 minutes, do Y" -- rather than simple trigger-action pairs. The practical results look like:

  • Turn on the porch light when motion is detected, but only after sunset and only when the security mode is armed
  • Send a notification if the garage door has been open for more than 15 minutes between 10 PM and 6 AM
  • Start the robot vacuum when everyone leaves the house, but only if it hasn't run today and only on weekdays
  • Adjust the thermostat setpoints based on tomorrow's weather forecast, not just a fixed schedule
  • Dim the living room lights gradually over 45 minutes before bed rather than switching them off abruptly

These automations change how you experience your home. They're the difference between a home that waits for commands and a home that responds to how you actually live. The garage door one caught me off guard -- I'd assumed I was good about closing it, but the first week of notifications showed I was leaving it open past midnight about twice a month.

The Home Assistant smart home guide covers the full device ecosystem -- sensors, integrations, and network setup -- that makes automations like these practical to build.

How Is the Home Assistant Automation Architecture Structured?

Home Assistant automations have four distinct components, and understanding all four is necessary for building anything beyond basic triggers.

Triggers start the automation. A state change in an entity, a time event, a webhook from an external service, a calendar entry, a numeric threshold crossing (temperature above 80F), or a tag scan all work as triggers. Multiple triggers can apply to a single automation -- any one of them fires the automation.

Conditions are optional checks that must pass before the automation proceeds. Is it currently after sunset? Is anyone home? Is the temperature above a threshold? Has this automation run in the last hour? Conditions use the same template syntax as other Home Assistant fields, which means they can be arbitrarily complex logical expressions.

Actions are what actually happens: call a service, send a notification, run a script, set a scene, add a delay, or loop through a sequence. Actions support parallel execution -- multiple things can happen simultaneously rather than sequentially.

Automation Modes

Mode controls what happens when an automation is triggered while already running:

  • Single: Ignore new triggers while running (default, good for most automations)
  • Restart: Cancel the current run and start fresh (good for "dim lights, wait, then turn off" sequences)
  • Queued: Finish the current run, then run again with the new trigger
  • Parallel: Run multiple instances simultaneously (use carefully)

Mode matters most for automations triggered by frequently-changing sensors. A motion sensor that fires every 30 seconds will restart the automation 30 times without "single" mode set -- which is usually not what you want.

When Should You Use YAML vs. UI Automations in Home Assistant?

The visual automation editor in Home Assistant covers around 80% of practical use cases. For the remaining 20%, raw YAML gives you access to every available option. New to the platform? The getting started guide walks through the initial configuration that makes the automation editor usable from day one.

YAML advantages go beyond just coverage. Automations written in YAML are easier to share with others, can be stored in version control (git), and can be packaged as Blueprints for reuse across multiple instances. The Home Assistant Blueprint documentation covers the format in detail -- Blueprints let you create parameterized automations where users fill in device names, thresholds, and times rather than editing YAML directly.

The Bridge approach works well: build an automation in the UI until you hit a limitation, then export it to YAML using the Edit as YAML button and extend it from there. The UI-generated YAML is clean and readable, making it a good starting point for manual editing.

How Do You Use Scripts and Scenes for Reusable Automation Logic?

Scripts in Home Assistant are named, reusable action sequences. Rather than duplicating identical action lists across multiple automations, you create a script once and call it from anywhere.

A "Movie Mode" script might dim the living room lights to 15%, adjust the bias lights behind the TV to a specific color temperature, set the thermostat down two degrees (movie watching generates body heat), and send the speaker volume to a preset level. The Philips Hue integration guide covers setting up full color and brightness control so scripts like this work reliably. Five automations can call that script -- from a voice command, a dashboard button, a TV power-on trigger, or a time-based scene. Change the script once and all five automations update.

Scenes work differently: they save the current state of a set of entities and let you restore that exact state later. "Living Room: Evening Reading" captures the brightness level, color temperature, and which lights are on for that specific state. Activate it from an automation or dashboard button and everything returns to that saved configuration simultaneously.

Scripts support wait_for_trigger and wait_template actions that pause execution until a condition is met or an event fires. This enables sequences like: "turn on lights, wait until motion stops being detected, delay 3 minutes, then turn them off." You can build this entire sequence in one script without needing separate automations for each step.

How Do You Set Up Presence Detection That Actually Works?

Reliable presence detection is the hardest problem in home automation. Get it wrong and automations fire when nobody's home (wasted energy) or fail to fire when people return (frustrating experience).

Common approaches and their failure modes:

  • Wi-Fi device tracking: Fast when someone connects, but mobile phones aggressively drop Wi-Fi when sleeping. False "away" readings are common.
  • GPS from phone apps: More reliable but has 1-5 minute delay between physical location change and state update.
  • Router-based tracking: Depends on your router's API. Very fast when it works; breaks completely when the router is updated.

The solution that works reliably is combining multiple presence methods through Home Assistant's Person entity system. A Person entity aggregates multiple device trackers for the same person and applies a sensible combination rule: if any tracker shows "home," the person is home; only when all trackers agree on "away" is the person considered away. This dramatically reduces false "away" readings.

The Home Assistant Companion app on iOS and Android provides both Wi-Fi device tracking and GPS, and sends state updates when significant location changes are detected. Pair it with router-based tracking and you get fast detection on arrival and reliable detection on departure. I've been running this combination for eight months -- the Person entity marked me "away" incorrectly once after a firmware update, compared to false readings every few days when I relied on Wi-Fi tracking alone.

For households that want room-level presence (not just home/away), mmWave presence sensors from brands like Aqara, Tuya, and Sonoff detect stationary people rather than just motion.

For energy-aware automations -- tracking which circuits are active rather than just who's home -- the TONGOU smart switch metering guide covers per-circuit consumption monitoring that feeds directly into presence-informed automations. A person sitting still reading is invisible to a PIR motion sensor but detected by a radar-based presence sensor.

How Do You Use Blueprints and the Community Exchange?

Blueprints are reusable automation templates that accept user-defined inputs. Installing a Blueprint gives you a complete, tested automation structure that you customize with your own device names, time values, and thresholds.

The Home Assistant Blueprint Exchange on the Home Assistant Community forum has thousands of contributed Blueprints covering common patterns: motion-activated lights with configurable timeout, door left open notifications, presence-based thermostat control, and hundreds of others. Before writing complex YAML for a common use case, it's worth checking whether a Blueprint already handles it. The SmartThings to Home Assistant migration guide maps common SmartThings automations to Blueprint equivalents -- useful if you're arriving from a commercial hub.

Creating your own Blueprints becomes useful once you've built an automation you want to replicate in multiple rooms or share with other Home Assistant users. The Blueprint format adds input definitions at the top of a YAML automation file -- a few extra lines that make the whole thing reusable.

How Do You Create Template Sensors and Calculated Values?

Template sensors compute values from other entities rather than reading from physical hardware. The current outside temperature minus the inside temperature, a boolean that's true when any window is open, the battery percentage of the lowest-battery device in your Zigbee mesh -- these are all template sensors. Devices with built-in metering like Shelly relays in local mode feed live wattage into template sensors that power energy dashboards and consumption-triggered automations.

Use template sensors when you want to trigger on a computed value rather than a raw entity state. "Run the whole-house fan when the outside temperature drops below the inside temperature by more than 3 degrees" is much cleaner as a trigger on a template sensor than as a conditional logic mess inside an automation.

Advanced automation in Home Assistant rewards patience. The learning curve is real -- YAML errors, integration quirks, and debugging broken automations are part of the experience. But the payoff is a home that responds to your actual patterns rather than rigid schedules, with no subscription and no cloud dependency. A locally-hosted voice assistant is the natural extension -- commanding your own server instead of a cloud endpoint fits the same local-first approach.

Running Home Assistant on a dedicated Raspberry Pi hub rather than a general-purpose machine reduces resource contention and keeps complex automations executing on schedule. The community around Home Assistant is one of its best resources. The Home Assistant Community forum and the r/homeassistant subreddit both have active users troubleshooting issues and sharing automation ideas. Most problems have been solved by someone else first.

If your base installation is still fresh, the first 10 things to configure after installation checklist covers the logging, backups, and coordinator setup that all advanced automations depend on.

Browse the guides below for detailed walkthroughs of building a fully automated home using these advanced techniques applied across a complete setup.

Frequently Asked Questions

Do Home Assistant automations require YAML knowledge?

Not for most use cases. The visual automation editor in Home Assistant covers around 80% of practical automation needs -- motion-triggered lights, presence-based thermostat control, time schedules, and door sensor alerts all work without touching YAML. For complex conditional logic (template conditions evaluating sensor values, multi-step sequences with delays and waits, or automations that branch based on state), YAML unlocks every available option the platform offers. The UI can export any automation to YAML for manual editing, so the common workflow is: build the automation visually, then switch to YAML view to add the conditions or actions the UI doesn't expose. The Home Assistant Blueprint Exchange also provides thousands of tested automation templates where you fill in device names without writing any YAML yourself. I've been running Home Assistant for three years; maybe 20% of my automations ever needed YAML, and that 20% handles the most interesting logic.

What are the four components of a Home Assistant automation?

Every Home Assistant automation has four distinct parts. Triggers are the conditions that start the automation -- a sensor reading, a time event, a device state change, a webhook, or a calendar entry. Conditions are optional checks that must pass for the automation to continue; a trigger fires the check, but if the condition fails, nothing runs. Actions are what actually happens -- turning lights on, sending notifications, calling a service, running a script, or activating a scene. Mode controls what happens if the automation fires again while it's already running: single mode cancels the new trigger, restart mode aborts the current run and starts over, queued mode lines up incoming triggers, and parallel mode runs multiple instances simultaneously. Understanding mode matters most for automations that include delays -- a "good morning" routine with a 30-second delay between steps behaves very differently in single versus restart mode.

What is the best presence detection method for Home Assistant?

Combining multiple trackers through a Person entity works best for reliable presence detection. The Home Assistant Companion app provides both Wi-Fi-based device tracking and GPS tracking; using both together means a brief Wi-Fi disconnect doesn't falsely mark you as away. A Person entity aggregates all associated trackers and is marked "away" only when all trackers agree, which eliminates most false triggers caused by phones temporarily dropping from the Wi-Fi access point. For faster home/away switching at the front door, a Bluetooth tracker -- phone, Apple Watch, or dedicated Bluetooth beacon -- triggers "home" as soon as you're within 30 feet; GPS updates often have a 3 to 5 minute lag. Some users add a door-sensor-based arrival confirmation as a third layer. I've had near-zero false "away" readings for over a year using Companion app GPS plus the HACS Bluetooth Tracker integration together.

What are Home Assistant Blueprints?

Blueprints are reusable automation templates with user-defined input fields. You install a Blueprint -- either from Settings > Automations or directly from a Blueprint Exchange URL -- fill in your device names and threshold values, and get a complete, working automation in under two minutes. The Home Assistant Blueprint Exchange at community.home-assistant.io has thousands of community-contributed templates covering common patterns: motion-activated lights with configurable timeout, door-open notifications with delay, presence-based thermostat adjustments, and multi-condition alarm triggers. Official built-in Blueprints cover the most common scenarios like motion-activated light and sun-angle-based brightness. Each Blueprint produces a separate automation instance, so you can use the same motion-light Blueprint for every room with different devices and timeouts. I use Blueprints for all my motion lighting -- one instance per room, all sharing the same tested logic. Editing the Blueprint once updates every room.

What is the difference between scripts and scenes in Home Assistant?

Scripts are named, reusable action sequences that can be called from multiple automations or triggered from Lovelace dashboard buttons. A script might turn off all lights, set the thermostat to 65, and lock the front door -- any automation can call it, and a dashboard button can run it manually. Scenes save a specific device state snapshot: which lights are on, at what brightness, in what color, and which switches are active. Restoring a scene puts every device back to that exact saved state instantly. Scripts run actions forward from wherever you call them; scenes restore a captured state from the past. Use a script for a bedtime routine that checks sensor state before acting, and a scene for a movie-watching lighting preset you want to re-apply identically every time. I keep about 15 scripts and 20 scenes in my setup -- they handle completely different jobs without any overlap.