This device has no voice for this language. You can add one in your device’s speech settings.
How to Describe What Your Home Should Do
Every automation is a rule that tells the system what to do, and when. A well-written rule makes a home feel natural and helpful. A badly written rule makes lights switch off while people are still in the room, or makes the heating run when nobody is at home.
Fortunately, almost all automation – whether it is created in a mobile application, in a home automation server or in program code – is built from the same three parts: a trigger, conditions and actions.
This guide explains these parts and how to combine them into rules that are clear, predictable and easy to maintain.
1. The Three Parts of a Rule
A typical rule can be written as one sentence:
WHEN something happens,
IF certain conditions are true,
THEN do something.
- Trigger (WHEN) – the event that starts the rule, such as motion being detected or the time reaching 07:00.
- Conditions (IF) – checks that must be true at that moment for the rule to continue, such as "it is dark" or "someone is at home".
- Actions (THEN) – what the system does, such as switching on a light or sending a notification.
Different systems use different words. Some applications call the trigger "if" and the actions "then". Others talk about "automations", "scenes", "routines" or "flows". The principle is the same.
2. Triggers – What Starts a Rule
A trigger is a change or an event. Common types are:
| Type of Trigger | Example |
|---|---|
| Device state changes | A door opens, motion is detected, a switch is turned on |
| A value crosses a limit | The temperature falls below 18 °C, the humidity rises above 70% |
| Time | Every weekday at 06:30 |
| Sun position | At sunset, or 30 minutes before sunrise |
| People arriving or leaving | The first person arrives home, the last person leaves |
| Button or voice command | A button is pressed twice, a voice assistant receives a command |
| System events | The controller has restarted, a device has stopped responding |
It is important to understand that a trigger reacts to a change. A rule triggered by "the temperature is below 18 °C" usually starts at the moment the temperature crosses the limit – not continuously for as long as it stays below it.
3. Conditions – When a Rule May Run
Conditions are checked at the moment the trigger occurs. If a condition is not met, the rule stops and no action is taken.
Conditions make the same trigger useful in different situations:
WHEN motion is detected in the hallway,
IF the light level is below 30 lux
AND the time is between 07:00 and 23:00,
THEN switch on the hallway light at full brightness.
WHEN motion is detected in the hallway,
IF the time is between 23:00 and 07:00,
THEN switch on the hallway light at 10% brightness.
The second rule gives a gentle night light, so that nobody is dazzled on the way to the bathroom.
4. Combining Conditions: AND, OR and NOT
Conditions can be combined using simple logic:
- AND – all conditions must be true. "It is dark AND someone is at home."
- OR – at least one condition must be true. "The front door OR the back door is open."
- NOT – the condition must be false. "NOT on holiday mode."
Most applications combine conditions with AND by default. When you need OR, you may have to create a separate rule or use a specific setting for it.
Keep combinations simple. If a rule needs many conditions, it is often clearer to split it into two or three smaller rules, or to use a mode (see below).
5. Actions – What Happens
Actions are the commands the system sends. A rule can perform one action or several in a sequence:
- Switch, dim or change the colour of lights.
- Set a temperature or a heating mode.
- Open or close blinds, valves or gates.
- Activate a scene – a saved set of states for several devices at once.
- Send a notification, an e-mail or a message.
- Change a mode or a helper value, such as setting the home to "night".
- Wait for a time, or wait until something else happens.
When a rule contains several actions, consider their order. For example, close the water valve before sending the notification about a leak, so that the most important action is not delayed.
6. Time, Delays and Durations
Time is one of the most useful tools in automation logic:
- Delays – "switch off the light three minutes after the last motion".
- Durations – "only if the window has been open for more than ten minutes". This prevents reactions to short, unimportant changes.
- Time windows – "only between sunset and 23:00".
- Timeouts – "if the garage door is still open after 15 minutes, send a reminder".
Durations are a simple way to make rules more reliable. A sensor value that briefly crosses a limit, or a door that is opened for two seconds, will not cause unnecessary actions. Guide 12 explains timers and schedules in more detail.
7. States and Modes
Many rules become much simpler if the system keeps track of the overall situation in the home. This is often done with modes – values that describe the state of the household, such as:
- Home, Away, Night or Holiday
- Guests present
- Alarm armed or disarmed
Instead of repeating the same set of checks in every rule, one rule sets the mode, and the other rules simply check it:
WHEN the last person leaves home,
THEN set the mode to Away.
WHEN the mode changes to Away,
THEN switch off all lights, lower the heating and arm the alarm.
Modes also make it easy to change behaviour later. A new rule can simply check "IF the mode is not Holiday" without knowing how the holiday mode is set.
8. Common Mistakes and How to Avoid Them
- Rules that work against each other – one rule switches a light on while another switches it off. Give each device one clear owner rule, or use modes to decide which rule applies.
- Loops – rule A triggers rule B, which triggers rule A again. Check what each action can trigger.
- Switching back and forth – a fan switching on at 70% and off at 69% will cycle constantly. Use separate on and off limits or a minimum running time.
- Forgotten people – a light that switches off after one minute may be fine in a corridor, but not in a room where people sit still. Think about how the room is used.
- No manual way out – make sure that people can override the automation easily. Guide 5 explains how.
- Untested assumptions – test each rule in real situations, including at night, when nobody is home and after a power cut.
9. Writing Rules That Are Easy to Maintain
After a year, a home may have dozens of rules. These habits help keep them understandable:
- Write each rule as a sentence before you create it.
- Give every rule a clear name, such as "Hallway – light on motion at night".
- Keep one purpose per rule.
- Group rules by room or function.
- Write down why unusual rules exist.
- Remove rules you no longer use.
Final Thoughts
Automation logic is the heart of every home automation system. Almost every rule can be described with three parts: a trigger that starts it, conditions that decide whether it should run, and actions that carry out the result.
Combining conditions carefully, using delays and durations, and keeping track of modes makes it possible to create rules that behave sensibly in real daily life.
Start with simple, clearly named rules, test them well, and build more advanced logic only when you need it.
MISOLIMA® – Technology Made Practical.
Practical knowledge for understanding, designing and building home automation.
Continue reading
Back to the topGuide 1
What Is Home Automation?
Guide 2