Current Date:17 September, 2021

How to automatically turn on lights at sunset in Home Assistant using Automation Editor

One of my favourite quick and easy automations for Home Assistant is turning on a few lights at sunset. This is a great way to light up the house, give you a visual indicator of when the sun is about to set and also a way of making it look like you’re home.

I’ll take you through setting up an automation tasks to automatically turn on the lights at sunset using Home Assistant’s Automation Editor.

Let’s get to it!

Configuring Sunset Lights Automation in Home Assistant

  1. Click on Configuration
  2. Scroll down and click on Automation
Automation option in Home Assistant
  1. Click on the +
  2. Give your automation a <strong>NAME</strong> and set the DESCRIPTION
Automation name and description in Home Assistant
  1. Select SUN for the TRIGGER TYPE
  2. Select SUNSET for the Event.

This step tells Home Assistant to run this automation when the sun is in the state of “Sunset”

Sun configuration in Home Assistant
  1. Scroll Down to ACTIONS
  2. Select CALL SERVICE for the ACTION TYPE
  3. Select light.turn.on for the SERVICE
  4. Enter the entity_id
entity_id: light.bedroom_light
  1. Click on ADD ACTION and repeat steps 8 to 10 to add more lights to the automation.

If you’re not sure what the entity_id of the light is, the easiest way to check is to navigate to DEVELOPER TOOLS > STATES and search for the light then copy and paste the device name.

Testing your configured Automation in Home Assistant

Now that you have created your automation, we can test it without having to wait for sunset.

  1. Navigate back to AUTOMATION EDITOR
  2. Click on the i next to the automation you just setup
  3. Click on TRIGGER
  4. The lights you configured should turn on. If they do then we have the correct lights setup.
  5. Wait until SUNSET and your lights will turn on automatically.

More Information

You can read more about the Automating Home Assistant documentation or see my other Home Assistant articles.


If you’d like to support TECHmarC, or if you’re using an adblocker, I ask you to consider whitelisting my website.

The ads displayed on this site help go towards keeping the website alive. I know its a small ask but every little contribution helps! You can also support me by Buying me a Coffee!


Buy me a coffeeBuy me a coffee