Sunrise

The Sunrise trigger fires the moment the sun rises above the horizon at your location. Home Assistant calculates the exact time for every day of the year from your home location, so the trigger stays accurate as sunrise shifts through the seasons.

Use it to open blinds, turn off outdoor or night lighting, or start your morning routine the moment the day begins.

Using this trigger from the user interface

If you prefer building automations visually, Home Assistant walks you through this trigger step by step. You pick what to watch, tweak a few options, and save. No YAML knowledge required.

To use this trigger in an automation:

  1. Go to Settings > Automations & scenes.
  2. Open an existing automation, or select Create automation > Create new automation.
  3. In the When section, select Add trigger.
  4. From the search box, search for and select Sunrise.
  5. Optionally, set an offset to fire before or after sunrise:
    • Under Offset, select Before or After.
    • Under Duration, enter how far from sunrise to fire, such as 30 minutes.
  6. Select Save.

Options in the UI

Offset

Whether to fire before or after sunrise:

  • No offset: fires exactly at sunrise. This is the default.
  • Before: fires the duration you enter before sunrise.
  • After: fires the duration you enter after sunrise.

Using this trigger in YAML

If you work directly in YAML, or you want to know exactly what Home Assistant does under the hood, this section has the technical reference. It lists the field names you use in YAML, their types, and which ones are required. For how an automation is built in YAML, refer to Automations in YAML.

In YAML, put the settings that are specific to this trigger under options. Keep target, if the trigger uses one, and general settings such as id, alias, enabled, and variables at the top level, next to trigger.

When this trigger starts an automation, it passes data about what happened to the automation. You can use this trigger data in the templates of your conditions and actions. To see which data is available, refer to Trigger data in templates.

In YAML, refer to this trigger as sun.sunrise. A basic example looks like this:

TriggerA trigger is the part of an automation that makes the automation start when something specific happens, for example, when the sun sets, a door opens, or a button is pressed. [Learn more]
trigger: sun.sunrise

This fires every day, the moment the sun rises above the horizon. To fire a fixed amount of time before or after sunrise, add the offset option. A negative offset fires before and a positive one after:

TriggerA trigger is the part of an automation that makes the automation start when something specific happens, for example, when the sun sets, a door opens, or a button is pressed. [Learn more]
trigger: sun.sunrise
options:
  offset:
    minutes: 30

This fires 30 minutes after sunrise every day.

Options in YAML

offset time (Optional, default: 00:00:00)

The length of time from sunrise when the trigger fires. Accepts a time period mapping in hours, minutes, seconds, and days. Also accepts a duration string in HH:MM:SS format. A negative value, such as minutes: -30 or "-00:30:00", fires before sunrise. A positive value fires after.

Good to know

  • This trigger does not use a target. It applies to the sun at your configured home location.
  • To fire a fixed amount of time before or after sunrise, set the Offset option. For light-based timing that adapts to the seasons, use Sun elevation crossed threshold instead.
  • To react to the first light before sunrise, use Dawn. To react when the sun goes down, use Sunset.
  • The Sun entity can change to Above horizon a few minutes after this trigger fires. To check whether the sun has risen, use the Sun is up condition instead. Without an offset, it changes at the same moment as this trigger.

Try it yourself

Ready to test this? Go to Settings > Automations & scenes, create a new automation, and add this trigger. Save the automation, and then make the trigger react. For example, change the state of the targeted entityAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more], turn on a light that the trigger monitors, or change its brightness. To check whether the automation ran, open its traces.

For this trigger, there is no target entity to change. To test it, wait for the next sunrise, or temporarily switch to a trigger you can control while you build the rest of the automation.

More examples

Real scenarios where this trigger fires in automations and scripts. Copy any example and adapt it to your setup. In the visual editor, select the UI options listed in the example when they are available, or paste the YAML code.

Tip

You don’t need to edit YAML to use these examples. Copy a YAML snippet from this page, open the visual automation editor in Home Assistant, and press Ctrl+V (or Cmd+V on Mac). Home Assistant automatically converts the pasted YAML into the visual editor format, whether it’s a full automation, a single trigger, a condition, or an action.

Automation: open the living room blinds at sunrise

When the sun rises, open the living room blinds so the room fills with daylight.

  • Trigger: Sunrise
  • Action: Open cover
    • Target: Living room blinds
YAML example for opening blinds at sunrise
AutomationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home. [Learn more]
alias: "Open living room blinds at sunrise"
triggers:
  - trigger: sun.sunrise
actions:
  - action: cover.open_cover
    target:
      entity_id: cover.living_room_blinds

Still stuck?

To find out why the trigger didn’t react, make the change that it should react to, and then open the traces of the automation. If the automation didn’t run, there’s usually no trace, but some triggers record a Did not trigger trace. For details, refer to Testing automations. For common problems and their solutions, refer to Troubleshooting automations.

If that doesn’t help, the Home Assistant community is quick to help: join Discord for real-time chat, post on the community forum with the trigger you’re using and what you expected to happen, or share on our subreddit /r/homeassistant.

Tip

AI assistants like ChatGPT or Claude can also explain triggers or suggest the right one when you describe what you want in plain language.

Related triggers

Explore related triggers:

  • Sunset: Triggers when the sun sets.

  • Dawn: Triggers at dawn, when civil, nautical, or astronomical twilight begins.

  • Sun elevation crossed threshold: Triggers when the sun’s elevation crosses a threshold you set.