Lesson 5 of 5
Advanced Automations
Estimated time: 5 minutes
Advanced Automations
Scenes and voice commands are great, but they still require you to say something. The most powerful smart home setups respond to events — motion detected, temperature changes, time of day, or even your location. In this lesson, you'll build automations that run without any input.
Triggers, Conditions, and Actions
Every automation has three parts:
TRIGGER CONDITION ACTION
┌──────────┐ ┌──────────────┐ ┌──────────────┐
│ Something │───────>│ Only if... │───────>│ Then do... │
│ happens │ │ (optional) │ │ │
└──────────┘ └──────────────┘ └──────────────┘
Examples:
Motion detected → After 10 PM → Turn on path lights at 10%
Temp above 76°F → AC is off → Turn on AC, alert me
I leave home → Weekday → Activate "leaving" scene
Sunset → Anyone is home → Turn on porch light
Create a motion-triggered automation
The most common automation: lights that respond to motion.
openclaw chat "Create an automation:
Trigger: Motion detected on hallway sensor
Condition: It's after sunset and before sunrise
Action: Turn on hallway lights at 15% for 3 minutes,
then fade off
Name it 'Night Hallway'"
✅ Automation created: Night Hallway
Trigger: Hallway motion sensor → motion detected
Condition: After sunset AND before sunrise
Action: Hallway lights → 15% warm white → off after 3 min
Status: Active
This is especially useful for nighttime bathroom trips — soft light that doesn't blind you and turns itself off.
Build temperature-based automations
Let your home respond to temperature changes:
openclaw chat "Create two automations:
1. 'Too Hot Alert'
Trigger: Indoor temperature above 78°F
Condition: AC is not running
Action: Turn on AC to 73°F, send me a message
2. 'Window Breeze'
Trigger: Outdoor temp between 65-75°F
Condition: AC is running, windows are closed
Action: Send suggestion to open windows and turn off AC"
✅ 2 automations created
1. Too Hot Alert — Active
If temp > 78°F and AC off → AC on at 73°F + notify
2. Window Breeze — Active
If outdoor 65-75°F and AC running → suggest opening windows
Suggestions vs. actions
Notice that "Window Breeze" sends a suggestion instead of taking action. That's intentional — OpenClaw can't open your windows, and you might have reasons to keep them closed (allergies, noise). Use suggestions for actions that need human judgment.
Set up presence-based automations
Automate based on whether you're home or away:
Use your phone's location to trigger home/away:
openclaw skill add geofence \
--radius 200m \
--home-address "123 Main St, City, ST"
openclaw chat "Create automations:
1. 'Welcome Home': When I arrive home → activate 'good morning'
scene if before noon, or turn on hallway lights if after noon
2. 'Away Mode': When everyone leaves → activate 'leaving' scene
after 5 minute delay (in case someone forgot something)"
Create time-based automations
Schedule actions that don't need a full scene:
openclaw chat "Create these scheduled automations:
1. Every day at sunset: turn on porch light
2. Every day at 11 PM: lock all doors, check all windows
3. Every weekday at 6:30 AM: start coffee maker
4. Every Sunday at 10 AM: send me a smart home weekly report
(energy usage, automation triggers, any anomalies)"
✅ 4 scheduled automations created
🌅 Sunset Porch — daily at sunset
🔒 Night Lockup — daily at 11:00 PM
☕ Morning Coffee — weekdays at 6:30 AM
📊 Weekly Report — Sundays at 10:00 AM
The weekly report looks like:
📊 Smart Home Weekly Report — Mar 23
⚡ Energy: 42 kWh this week (↓8% from last week)
Top consumer: HVAC (58%), EV charger (22%)
🤖 Automations triggered: 47 times
Night Hallway: 12 | Too Hot Alert: 3
Welcome Home: 10 | Away Mode: 8
Sunset Porch: 7 | Night Lockup: 7
⚠️ Anomalies:
Kitchen motion sensor triggered 23 times on Wednesday
(normal: 8-12). Possible pet activity or sensor issue.
💡 Suggestion: Your "Too Hot Alert" triggered 3 times.
Consider lowering your AC schedule by 1 hour.
Chain automations together
Build complex workflows by chaining triggers:
openclaw chat "Create a 'Goodnight Sequence' automation:
Trigger: I say 'goodnight' in chat
Action (in order):
1. Wait 5 minutes (I'm getting ready for bed)
2. Lock all doors
3. Close garage door if open
4. Arm security system (home mode)
5. Turn off all lights except bedside lamp at 5%
6. Set thermostat to 67°F
7. Send confirmation message
If any door or window is open (except bedroom window),
warn me before locking up."
openclaw chat "goodnight"🌙 Goodnight Sequence starting in 5 minutes...
⚠️ Heads up: The kitchen window is open.
Should I proceed anyway, or wait for you to close it?
As automations grow, keep them organized:
openclaw chat "List all my automations with their trigger counts this month"openclaw chat "Disable the Night Hallway automation for this week — we have guests"openclaw chat "Show me automations that haven not triggered in 30 days"When an automation doesn't fire as expected:
openclaw chat "Why didn't the Night Hallway automation
trigger last night at 2 AM? I walked through the hallway."
OpenClaw checks the logs and explains: maybe the motion sensor didn't register, the condition wasn't met (already past sunrise), or another automation conflicted.
Course Complete
You now have a fully chat-controlled smart home:
- Hub connected — Home Assistant or SmartThings linked to OpenClaw
- Scenes — Multi-device presets activated by a single word
- Natural language — Talk to your home like a person
- Automations — Your home responds to motion, temperature, time, and presence
The best smart home is one you don't have to think about. With these automations running, your home anticipates your needs instead of waiting for commands.
Why does the 'Away Mode' automation include a 5-minute delay?