← All articles
Home Automation

Triggers, conditions and actions explained for beginners

Most home automations are built from a trigger, optional conditions and one or more actions. Learn what each part does and how to test a simple rule before you rely on it.

A cartoon-style man and woman working at a desk in a room with large windows showing a rainy garden, where the man points to a smart home sensor attached to the window while the woman adjusts a small fan.

Almost every basic home automation is built from three parts: a trigger that starts the rule, optional conditions that must also be true, and one or more actions that happen as a result. Setup screens can look intimidating because the same three ideas appear under different labels, but the logic is simple. Each part answers one plain question: what starts the rule, what must also be true, and what happens next. Read a rule in that order and most automations become easy to follow.

A beginner usually gets the best results by building one rule with all three parts before attempting anything complicated. The examples below use a single rule for a home office: a fan turns on when the room gets too warm and turns off once it cools. Each part is explained separately, followed by a staged way to test the rule so that problems show up while the stakes are low.

Triggers start the rule

A trigger is the event that makes the rule check whether it should act. Common triggers include a sensor reporting motion or an opened door, a device switching on or off, a set time of day, and a sunrise or sunset time. Sunrise and sunset triggers depend on the location saved in the home app, so a wrong location can make a sunset light come on well away from the actual sunset.

A trigger that fires often is not a problem by itself, as long as the rest of the rule accounts for it. A motion sensor in a hallway may report movement many times an evening, so a rule that says "turn on the hall light when motion is detected" will run again and again. Pair that trigger with a condition, such as only after dark, and an off delay, such as turning the light off five minutes after the last movement. Many apps restart the off timer on each new movement, so repeated motion keeps the light on instead of toggling it.

Some triggers react to a value rather than a simple event, such as a temperature rising above a set level or a power reading passing a limit. These are useful, but a value that hovers right at the threshold can make a rule switch a device on and off repeatedly. For the office fan, a single threshold of 78 degrees Fahrenheit would chatter whenever the reading wobbles around that number. Choose an off point with some room to spare, such as 74 degrees, and check whether the app offers a separate off setting, which some apps call a differential.

Conditions limit when the rule runs

A condition is an extra check that must pass before the actions run. Typical conditions include a time window, such as only between 6 p.m. and 6 a.m., the state of another device, such as only when the living room lamp is off, or the mode of the home, such as only when everyone is away. Conditions are optional. A rule with no conditions runs every time its trigger fires.

Conditions are often the answer when an automation fires at the wrong moment. If the office fan starts during the working day but no one is in the room, an occupancy condition can stop it without changing the temperature trigger. For example, the fan could run only if the office motion sensor reported movement in the last 15 minutes, or only while the home mode shows that someone is home. Keep conditions simple at first. Each extra condition is one more thing that can be wrong, and a rule that never runs often has a hidden condition that is blocking it. Remove conditions one at a time to see which one is the problem.

Actions do the work

An action is the change the rule makes, such as turning a light on or off, setting a thermostat, locking a door, sending a notification or starting another routine. Some rules have several actions, which run in order or at the same time depending on the app. Actions that depend on an earlier step, such as waiting for a plug to confirm that a device has switched on, are where small delays and failed commands tend to appear.

Many apps let you add a short delay between actions. A delay helps when one device needs a moment to finish before the next step, but long chains of delays make a rule hard to follow and harder to fix. If you find yourself adding several, consider splitting the work into two rules that each do one job.

Think about how each action ends as well. If a rule turns the fan on when the room gets warm, something else has to turn it off later. Without a plan for switching things off, fans, lights and heaters can run for hours. A timed action, such as turning the fan off after 30 minutes, or a second rule that turns it off when the temperature drops below the off point, prevents this and is a useful habit for any rule that switches something on.

Testing a rule in stages

Test each new rule in stages, and do not skip ahead. First, check the trigger by warming the sensor gently with your hand while you watch the activity log in the app. If the event appears in the log, the rule has received it. For a temperature rule that is hard to warm, set a temporary threshold just above the current room reading, warm the sensor slightly with your hand until the reading crosses it, and confirm that the event appears and the fan starts. Some apps fire a value trigger only when the reading crosses the threshold, so a threshold the reading has already passed may never fire, while others fire on any value past the level. Check which kind your app uses, then restore the real threshold. Next, check each condition by running the trigger at a time when the condition should pass and again when it should fail. Finally, check the action by confirming that the device changes state and changes back.

Many home apps offer a test or run-now option for an automation. Use it to confirm that the actions work, but also run one real test with the physical trigger, because a manual test does not prove that the sensor and the rule are connected correctly. Leave the rule active for a few days and then review the history for unexpected runs. A rule that works in testing but fires at odd hours usually has a trigger that runs more often than you expected, or a condition that was set incorrectly.

Once a rule has passed these checks, write its trigger, conditions and actions in one plain sentence and keep that note with your other setup records. The note takes a minute to write and saves time the next time you need to change or troubleshoot the rule, since you will not have to rebuild its logic from a set of screens.