It is morning twilight

The It is morning twilight condition passes during the gradually brightening period before sunrise, while the sun is below the horizon but the sky is no longer completely dark. You can match any morning twilight, or narrow it to a specific phase: civil, nautical, or astronomical. Home Assistant works this out from your home location.

Use it to run an automation in that pre-dawn window, like starting a gentle wake-up routine or raising the blinds as the sky begins to lighten.

Using this condition from the user interface

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

To use this condition in an automation:

  1. Go to Settings > Automations & scenes.
  2. Open an existing automation, or select Create automation > Create new automation.
  3. In the And if section, select Add condition.
  4. From the search box, search for and select Sun: It is morning twilight.
  5. Under Twilight type, select Any, Civil, Nautical, or Astronomical.
  6. Select Save.

Options in the UI

Twilight type

Which phase of morning twilight passes the condition:

  • Any: any twilight, from the end of night up to sunrise. This is the default.
  • Civil: the sun is between 6° below the horizon and sunrise. The brightest twilight.
  • Nautical: the sun is between 12° and 6° below the horizon.
  • Astronomical: the sun is between 18° and 12° below the horizon. The darkest twilight, closest to night.

Using this condition 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.

In YAML, refer to this condition as sun.is_morning_twilight. A basic example looks like this:

ConditionConditions are an optional part of an automation that will prevent an action from firing if they are not met. [Learn more]
condition: sun.is_morning_twilight

This passes during any morning twilight. To match a specific phase, add the type option:

ConditionConditions are an optional part of an automation that will prevent an action from firing if they are not met. [Learn more]
condition: sun.is_morning_twilight
options:
  type: civil

Options in YAML

type string

Which phase of morning twilight passes the condition. Accepts any (any twilight up to sunrise), civil (sun between 6° below the horizon and sunrise), nautical (between 12° and 6° below), or astronomical (between 18° and 12° below).

Good to know

  • This condition does not use a target. It checks the sun at your configured home location.
  • Morning twilight is the rising side of the day. The matching period after sunset is It is evening twilight.
  • The phases are stacked: astronomical is darkest and comes first, then nautical, then civil, then Sun is up at sunrise. Any covers all three.
  • The length of twilight changes through the year and with your latitude. Near the poles, a phase can fail to occur on some days, and the condition does not pass then.

Try it yourself

Ready to test this? Go to Settings > Automations & scenes, open an automation, and add this condition. Trigger the automation with and without the condition met, and watch whether it continues or stops.

More examples

Real scenarios where this condition gates an automation. Copy any example and adapt it to your setup.

Tip

You don’t need to edit YAML to use these examples. Copy a YAML snippet from this page, open the 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: gentle wake-up light at civil dawn

When your alarm helper is on, fade the bedroom light in during civil morning twilight so you wake with the brightening sky.

  • Trigger: Bedroom motion detected
  • Condition: Sun: It is morning twilight (Civil)
  • Action: Turn on light (at low brightness)
    • Target: Bedroom light
YAML example for a pre-dawn wake-up light
AutomationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home. [Learn more]
alias: "Wake-up light at civil dawn"
triggers:
  - trigger: state
    entity_id: binary_sensor.bedroom_motion
    to: "on"
conditions:
  - condition: sun.is_morning_twilight
    options:
      type: civil
actions:
  - action: light.turn_on
    target:
      entity_id: light.bedroom
    data:
      brightness_pct: 20

Still stuck?

The Home Assistant community is quick to help: join Discord for real-time chat, post on the community forum with the condition 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 conditions or suggest the right one when you describe what you want in plain language.

Related conditions

These conditions work well alongside this one: