Use the Sun trigger in the Automations menu to turn on your lights at sunset. Many people believe they need a complex script or a third-party plugin to track the sun, but this functionality is built directly into the core system.
The system uses your home's coordinates to calculate the exact moment the sun dips below the horizon each day. This means your lights will automatically adjust their start time as the seasons change throughout the year. You do not need to manually update the schedule every month.
Sunset Trigger Sets the Start Time
To begin, navigate to Settings > Automations & Scenes > Create Automation. Select "Create new automation" to open the editor. The trigger is the event that tells Home Assistant to start the process.
- Click "Add Trigger" and select "Sun" from the list of trigger types.
- Choose "Sunset" from the dropdown menu.
- Leave the "Offset" blank if you want the lights to turn on exactly at the moment of sunset.
The system calculates sunset based on the latitude and longitude you entered during the initial setup of your home. If the lights are triggering at the wrong time, check your home location in Settings > System > General. Labels in these menus may differ slightly depending on your version.
Sunset Offsets Adjust for Ambient Light
A common misconception is that "Sunset" means it is dark enough to need lights. In reality, there is a period of twilight after the sun sets where natural light remains. If you find your rooms are still too bright at the exact moment of sunset, you can use an offset.
An offset allows you to shift the trigger time forward or backward. A positive offset (e.g., 00:30:00) triggers the automation after sunset, while a negative offset (e.g., -00:30:00) triggers it before sunset. This is useful for creating a gradual transition into the evening, which may help you feel calmer as you wind down from the day.
| Desired Effect | Offset Value | Result |
|---|---|---|
| Early Glow | -00:30:00 | Lights on 30 minutes before sunset |
| Exact Sunset | 00:00:00 | Lights on at the moment of sunset |
| Deep Twilight | 00:45:00 | Lights on 45 minutes after sunset |
Action Step Turns on the Lights
Once the trigger is set, you must define the action. The action is the physical change that happens in your home. Without an action, the automation will trigger in the background, but nothing will happen in your room.
- Click "Add Action" and select "Device".
- Choose the specific light or light group you wish to control.
- Select "Turn on" from the action list.
If you have multiple lights in a room, it is more efficient to create a "Light Group" in the Helpers menu first. This allows you to trigger one group action rather than listing ten individual bulbs. This keeps your automation list clean and easier to manage.
Conditions Prevent Unwanted Lighting
A simple sunset trigger will turn the lights on every single day, regardless of whether you are home or if the room is already bright. Adding a condition ensures the lights only turn on when it is actually useful. This prevents the waste of energy and reduces visual clutter.
The most practical condition for sunset lighting is "State". You can set the automation to only run if a specific light is already off, or if a motion sensor detects someone in the room. For example, if you have a bright lamp already on, you may not want the overhead lights to activate. Adding a condition that checks if "Light A is off" prevents redundant actions.
Another helpful condition is "Presence". By linking the automation to a device tracker, the lights will only turn on at sunset if your phone is connected to the home network. This ensures you don't return to a fully lit house after a long trip, which keeps your home feeling minimal and intentional.
Rule of Thumb for Evening Lighting
A useful rule of thumb is to set your sunset offset to 30 minutes after sunset for general living areas. This avoids the "too bright" feeling of early evening while ensuring you aren't sitting in the dark. For outdoor security lights, a negative offset of 15 to 30 minutes is often better, as it ensures the paths are lit before the darkness becomes a safety concern.
When choosing the brightness of your sunset lights, consider a lower percentage for the initial trigger. Starting your lights at 30% or 40% brightness creates a softer transition. This gentle increase in light is less jarring than a sudden 100% brightness burst, supporting a more peaceful environment.
Sunset Automations for Different Rooms
Not every room requires the same sunset logic. The amount of natural light varies based on which direction the windows face. A west-facing room stays bright long after the sun has set, while an east-facing room becomes dark much earlier.
Living Areas and Kitchens
These spaces often benefit from a "Sunset + 30 minutes" trigger. Because these are high-activity areas, you can use a condition that checks for motion. If no motion is detected for 10 minutes, the lights can turn off automatically, maintaining a minimalist approach to energy use.
Bedrooms and Bathrooms
In these private spaces, you may prefer a "Sunset - 30 minutes" trigger. This allows the room to be softly lit before you enter to begin your evening routine. Using a dimmable bulb here allows you to set a warm color temperature, which may help you relax as you prepare for sleep.
Outdoor and Porch Lights
Outdoor lighting should typically trigger exactly at sunset or slightly before. Since there are no walls to block the light, the transition to darkness is more apparent. You can pair this with a "Sunrise" trigger to turn the lights off, ensuring they never stay on throughout the day.
Hallways and Entryways
Entryways are best served by a sunset trigger combined with a motion sensor. Instead of the lights staying on all night, the sunset trigger "arms" the motion sensor. This means the lights only turn on when you walk through the door after the sun has gone down, providing light exactly when needed and not a moment sooner.
Sunset Logic for Seasonal Changes
Because Home Assistant uses astronomical data, your lights will naturally follow the solar cycle. In the summer, your lights may not turn on until 9:00 PM, while in the winter, they may activate at 4:30 PM. You do not need to create separate "Winter" and "Summer" automations.
If you find that the change in seasons affects your mood or routine, you can use a "Time" condition to limit the automation. For instance, you could specify that the sunset trigger only works if the time is before 8:00 PM. This prevents lights from turning on during the long summer evenings if you prefer to stay in the natural dark.
For those who prefer a very strict routine, you can ignore the Sun trigger and use a fixed time. However, the Sun trigger is generally preferred because it aligns your home's environment with the natural world, which is a core principle of slow living and mindful home management.
What happens if the internet goes down?
Home Assistant stores the sun's position locally based on your coordinates. As long as your internal server is running, the sunset trigger will work even if your internet connection is interrupted. The system does not need to "call" a weather service every minute to know when the sun sets.
Can I use a light sensor instead?
Yes, using a lux sensor (a light level sensor) is an alternative to the Sun trigger. A lux sensor triggers based on actual darkness rather than a calculated time. This is useful if you have heavy curtains or live in a city with significant light pollution. You would set the trigger to "Numeric State" and trigger when the lux value drops below a certain number, such as 50 lx.
How do I turn the lights off in the morning?
To turn the lights off, create a second automation. Use the "Sun" trigger again, but select "Sunrise". For the action, select your light group and choose "Turn off". You can apply a positive offset here as well, such as 30 minutes after sunrise, to keep the lights on until the room is fully illuminated by the morning sun.