Automation
This page will talk about automating Home Assistant using the automation
component. For more advanced ways of automation, see the create a component page.
Each part of automation consists of two parts: the trigger part and the action part. The final result will look something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
Setting up triggers
Time-based automation
This allows you to trigger actions whenever the time matches your filter. You can setup filters to match on hours, minutes and seconds. Any filter that you omit will match all values.
Here are some example values:
1 2 3 4 5 6 7 8 9 10 |
|
State-based automation
This allows you to trigger actions based on state changes of any entity within Home Assistant. You can omit the state_from
and state_to
to match all.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
Use quotes around your values for state_from
and state_to
to avoid the YAML parser interpreting some values as booleans.
Setting up the action
Currently the only supported action is calling a service. Services are what devices expose to be controlled, so this will allow us to control anything that Home Assistant can control.
1 2 3 4 5 6 7 8 9 10 11 12 |
|
Putting it all together
For every combination of a trigger and an action we will have to combine the configuration lines and add it to an automation
component entry in configuration.yaml
. You can add an optional alias
key to the configuration to make the logs more understandable. To setup multiple entries, append 2, 3 etc to the section name. An example of a configuration.yaml
file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
All configuration entries have to be sequential. If you have automation:
, automation 2:
and automation 4:
then the last one will not be processed.