Triggers, Conditions, and Actions
Now that you understand how automation works at a high level, let's get into the three components you'll use to build every single automation.
Triggers: What Starts the Automation
A trigger is the event that kicks off your automation. Without a trigger, nothing happens. Here are the most common types:
Time-Based Triggers
- Specific time: "At 7:00 AM every weekday"
- Sunrise/sunset: "30 minutes before sunset" (adjusts automatically with seasons)
- Recurring: "Every 4 hours"
Device-Based Triggers
- Sensor: "When the motion sensor detects movement"
- Door/window sensor: "When the front door opens"
- Smart lock: "When the door is unlocked with code #3"
- Button: "When the smart button is pressed"
Location-Based Triggers
- Geofencing: "When I leave home" or "When I arrive at home"
- Proximity: "When my phone is within 100 feet of the house"
Voice Triggers
- Custom phrase: "When I say 'Movie time'"
Conditions: The "Only If" Rules
Conditions are optional filters that prevent an automation from running at the wrong time. They answer the question: "Should this automation actually run right now?"
Without conditions, a motion-activated light would turn on at 2 PM on a sunny day - not very useful. With a condition ("only if it's after sunset"), it becomes practical.
Common Conditions
- Time of day: "Only between 10 PM and 6 AM"
- Day of week: "Only on weekdays"
- Device state: "Only if the alarm is set to Away"
- Presence: "Only if nobody is home"
- Weather: "Only if the temperature is below 60°F" (limited platform support)
Pro tip: If an automation keeps running when you don't want it to, you probably need a condition - not a different trigger.
Actions: What Happens
Actions are the commands that execute when your trigger fires and all conditions are met. Most automations have multiple actions.
Common Actions
- Control devices: Turn on/off, set brightness, adjust temperature
- Delays: "Wait 5 minutes, then turn off the light"
- Notifications: Send a push notification to your phone
- Run another automation: Chain automations together
- Scenes: Activate a predefined scene (more on this in the next lesson)
Putting It All Together
Here's a well-designed automation using all three components:
Automation: Secure Goodnight
- Trigger: I say "Goodnight" to my voice assistant
- Conditions: It's after 8 PM (prevents accidental activation during the day)
- Actions:
- Turn off all lights
- Lock all doors
- Set thermostat to 68°F
- Set alarm system to "Home" mode
- Turn on bedroom fan (via smart plug)
Five actions, triggered by a single phrase, with a safety condition. That's a well-built automation.