Automating Home Assistant
Once your devicesA device is a model representing a physical or logical unit that contains entities.
are set up, it’s time to put the cherry on the pie: automationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home.
[Learn more]. We’re going to create a simple automation to turn on the lights when the sun sets. Of course, this assumes that you have set up an integration that provides a light at this point.
Automatically turn on the lights before sunset
-
Go to Settings > Automations & scenes and in the lower right corner, select the Create Automation button.
-
You are presented with a blank automation screen.
-
-
The first step is defining what should triggerA trigger is a set of values or conditions of a platform that are defined to cause an automation to run.
[Learn more] the automation to run.- In this case, we want to use the event of the sun setting to trigger our automation.
- Select Add trigger, type
Sun
and select it.
-
Select Sunset.
- We want the automation to be triggered a little before that, so let’s add
-00:30
as the offset. This indicates that the automation will be triggered 30 minutes before sunset. Neat!
- We want the automation to be triggered a little before that, so let’s add
-
Once we have defined our trigger, we need to define what should happen.
- Select Add action.
- Type
Ser
and select Call service
-
Select Light > Turn on or directly enter
light.turn_on
.- For this automation, we’re going to turn on all lights in the living room, so let’s select the Area.
- This only works if your lights are assigned to an areaAn area in Home Assistant is a logical grouping of devices and entities that are meant to match areas (or rooms) in the physical world: your home. For example, the
living room
area groups devices and entities in your living room..
-
To save the automation, select Save, give the automation a name and Save again.
- Now wait till it’s 30 minutes until the sun sets and see your automation magic!
Presence detection
If after completing this getting started you are interested in reading more about automations, we recommend the following pages:
Please note, these pages may require a bit more experience with Home Assistant than you probably have at this point of this tutorial.