Getting started: update automation section (#30802)

This commit is contained in:
c0ffeeca7 2024-01-15 09:30:51 +01:00 committed by GitHub
parent 1e1407f76a
commit 2197cb56fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 17 deletions

View File

@ -3,33 +3,38 @@ title: "Automating Home Assistant"
description: "A quick intro on getting your first automation going."
---
Once your {% term devices %} are set up, it's time to put the cherry on the pie: {% term automation %}. In this guide we're going to create a simple automation rule 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.
Once your {% term devices %} are set up, it's time to put the cherry on the pie: {% term automation %}. 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.
In the user interface in the sidebar, click **{% my automations title="Settings > Automations & Scenes" %}**. You will now see the automation screen from which you can manage all the automations in Home Assistant.
## Automatically turn on the lights before sunset
1. Go to {% my automations title="**Settings** > **Automations & scenes**" %} and in the lower right corner, select the **Create Automation** button.
![The automation editor.](/images/getting-started/automation-editor.png)
Click the blue button at the bottom right to create a new automation. A dialog will appear. Choose **Create new automation**. You are presented with a blank automation screen.
- You are presented with a blank automation screen.
![The start of a new automation.](/images/getting-started/new-automation.png)
The first thing we will do is set a name. Enter "Turn Lights On at Sunset".
The second step is defining what should {% term trigger %} our automation to run. In this case, we want to use the event of the sun setting to trigger our automation. However, if we would turn on the lights when the sun actually sets, it would be too late as it already gets quite dark while it's setting. So we're going to add an offset.
In the trigger section, click on the dropdown menu and change the trigger type to **Sun**. It allows us to choose sunrise or sunset, so go ahead and pick **Sunset**. As we discussed, we want our automation to be triggered a little before the sun actually sets, so let's add `-00:30` as the offset. This indicates that the automation will be triggered 30 minutes before the sun actually sets. Neat!
2. The first step is defining what should {% term trigger %} 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.
![Use the sun as trigger.](/images/getting-started/sun-trigger.png)
3. 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!
![A new automation with a sun trigger filled in.](/images/getting-started/new-trigger.png)
Once we have defined our trigger, scroll down to the action section. Make sure the action type is set to **Call service** and change the service to `light.turn_on`. For this automation we're going to turn on all lights, so let's change the service data to:
4. Once we have defined our trigger, we need to define what should happen.
- Select **Add action**.
- Type `Ser` and select **Call service**
5. 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 {% term area %}.
```yaml
entity_id: all
```
![A new automation with the action set up to turn on the lights in the living room.](/images/getting-started/action.png)
![A new automation with the action set up to turn on the lights.](/images/getting-started/action.png)
Click the orange button to save the automation. Now wait till it's 30 minutes until the sun sets and see your automation magic!
6. 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!
{% include getting-started/next_step.html step="Presence detection" link="/getting-started/presence-detection/" %}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB