Smart Lights Automated with Home Assistant

*The article below contains affiliate links. If you purchase an item after clicking on that link, I will receive a commission. Thank you!

If you have some lights or switches that control lights (check out these switches if you need some) and you want them to turn on automatically at sunset, Home Assistant makes that very simple.

Prerequisites

  • Home Assistant
  • Smart Switches or Smart Lights

To start this automation you will want to go to the “Settings” tab and then select “Automations & Scenes”

The Automations & Scenes selection in the Settings tab

From here you will set up a new automation for your smart lights by selecting the “+ Create Automation” button in the bottom right corner.

Create Automation button

There will be a popup that asks if you want to use a blueprint or start with an empty automation. The smart lights do not have a blueprint when you first install Home Assistant, so you will want to start with an empty automation.

Now we are in the automation builder. Every automation can be broken down into three parts: Triggers, Conditons, and Actions.

Triggers

Triggers are what will start your automation. This can be any event or time that you choose. Since we want our smart lights to turn on at sunset, we will be using the sun setting as a trigger. Home Assistant has this functionality built-in which makes this automation very simple. Below is the trigger section of your new automation

Trigger section for smart lights automation
Trigger section for the smart lights

Trigger Type: We will select the “Sun” trigger for this so our smart lights get triggered by the sun.
Event: We will be picking sunset on this automation since we are turning our smart lights on when the sun goes down.
Offset: The offset is optional. Sometimes you want the lights to turn on at some point before sunset happens so that your house is not dark. For this automation I would recommend a 30 minute offset before sunset. Writing it out in HH:MM:SS would mean that the offset is -00:30:00.

Now that the trigger is set, we can move on to conditions.

Conditions

Conditions are an intermediate step in the automation that the system will check after the automation is triggered. If all conditions are met, the action will fire. Turning smart lights on at sunset doesn’t require any conditions, so we will leave them out.

Actions

The actions section is where we will actually turn the smart lights on. In the case of our Z-Wave switches, you can do this two ways. I will show the way I recommend which is to call a service.

Actions section for smart lights automation
Actions section for the smart lights

Action Type: We are going to call a service here. You could perform an action on a device itself, but since we may want multiple lights, it is better to call a service.
Service: We are using “Switch: Turn on” as the service here. There is also a service titled “Light: Turn on.” Since we are using lights that are actually controlled with smart switches, we want to turn the switches on. If you have smart lights controlled by the light itself, use “Light: Turn on.”
Targets: We then select the entities of the smart switches that we want to turn on.
You can add multiple actions to an automation. In this automation, if you have switches and lights that you would like to turn on, you can add both actions.

Once you have selected your entities, the automation is done! Simply hit save in the bottom right corner and the automation will start running 30 minutes before the next sunset.

Leave a Reply

Your email address will not be published. Required fields are marked *