5
Outdoor Light - Sunset, Night Off, Morning On
Kasper edited this page 2026-08-21 15:38:22 +02:00

Outdoor Light - Sunset, Night Off, Morning On

Overview

This Home Assistant Blueprint provides automatic control of outdoor lights based on the sun's elevation and configurable times.

The blueprint is designed for outdoor lighting that should:

  • Turn on automatically when it gets dark
  • Turn off at a configured time during the night
  • Optionally turn on again in the early morning
  • Turn off again when daylight returns

An optional enable entity can be used to enable or disable the automation.

Features

  • 🌅 Turns lights on automatically when it gets dark
  • 🌄 Turns lights off when daylight returns
  • 🌙 Configurable night-time shutdown
  • 🌅 Optional morning reactivation
  • ☀️ Uses sun elevation instead of fixed sunset/sunrise times
  • 🔘 Optional enable/disable entity
  • 💡 Supports one or multiple lights
  • ⚙️ Fully configurable through the Home Assistant Blueprint UI

How it Works

The automation has four independent triggers:

Sun elevation falls below evening elevation
                │
                ▼
            LIGHT ON
                │
                │
          Night Off Time
                │
                ▼
            LIGHT OFF
                │
                │
          Morning On Time
                │
                ▼
         Still dark?
          │         │
         YES        NO
          │          │
          ▼          ▼
      LIGHT ON    No action
          │
          │
   Sun elevation rises
   above morning elevation
          │
          ▼
      LIGHT OFF

Evening

When the sun's elevation falls below the configured Evening elevation, the selected lights are turned on.

Example

Evening elevation: -4°

The lights will turn on when the sun drops below -4° elevation.

Using sun elevation means the automation automatically follows the changing daylight throughout the year instead of relying on a fixed time.

Night Off

The lights can optionally be switched off at a fixed time during the night.

Example:

Night Off: Enabled
Night Off Time: 23:00

At 23:00 the lights are switched off.

This feature can be disabled if the lights should remain on throughout the entire night.

Morning On

The blueprint can optionally turn the lights back on in the morning.

Example:

Morning On: Enabled
Morning On Time: 05:30

At 05:30 the automation checks the sun's elevation.

The lights will only turn on if the sun is still below the configured Morning elevation.

This prevents the lights from being switched on when daylight has already arrived.

Example

Morning On Time: 05:30
Morning elevation: -4°

At 05:30:

Sun elevation < -4°
        │
        ├── YES → Lights ON
        │
        └── NO  → No action

Morning Off

When the sun rises above the configured Morning elevation, the lights are turned off.

For example:

Morning elevation: -4°

Once the sun reaches an elevation above -4°, the lights are switched off.

This provides the final daylight shutdown after the optional morning lighting period.

Enable Entity

An optional entity can be selected to enable or disable the automation.

For example:

input_boolean.outdoor_lights_enabled

When the entity is:

ON

the automation is allowed to control the lights.

When the entity is:

OFF

the automation will not perform any actions.

If no enable entity is selected, the automation is always enabled.

Blueprint Inputs

Input Description Default
Light(s) Light entities controlled by the automation —
Enable Entity Optional entity used to enable/disable automation None
Evening elevation Sun elevation at which lights turn on -4°
Morning elevation Sun elevation at which lights turn off -4°
Enable Night Off Enable automatic night shutdown Yes
Night Off Time Time when lights are switched off 23:00
Enable Morning On Enable morning reactivation Yes
Morning On Time Time when morning lighting is evaluated 05:30

A typical configuration for outdoor lighting could be:

Evening elevation:  -4°
Morning elevation:  -4°

Night Off:          Enabled
Night Off Time:     23:00

Morning On:         Enabled
Morning On Time:    05:30

This results in:

Dusk
  │
  ▼
Lights ON
  │
  │
23:00
  │
  ▼
Lights OFF
  │
  │
05:30
  │
  ├── Still dark → Lights ON
  │
  └── Already light → No action
  │
  │
Sun > -4°
  │
  ▼
Lights OFF

Example: Typical Day

Assuming:

Evening elevation: -4°
Night Off Time:    23:00
Morning On Time:   05:30
Morning elevation: -4°

The automation could behave like this:

Time Sun elevation Action
18:00 Above -4° No action
20:00 Below -4° 💡 Lights ON
23:00 Below -4° 🌙 Lights OFF
05:30 Below -4° 🌅 Lights ON
06:30 Above -4° ☀️ Lights OFF

The exact times will naturally change throughout the year because the evening and morning transitions are based on sun elevation.

Requirements

  • Home Assistant
  • sun.sun integration
  • One or more light entities

The optional Enable Entity can be any Home Assistant entity that provides an on/off state.

Installation

The easiest way to install this Blueprint is to use the Import Blueprint button below.

Automatic Installation

  1. Click Import Blueprint below.

  2. Home Assistant will open the Blueprint import page.

  3. Select Import Blueprint.

  4. Once imported, the Blueprint will be available under:

    Settings → Automations & Scenes → Blueprints
    
  5. Create a new automation from the Blueprint.

  6. Select the required entities and configure the desired settings.

Import Blueprint

Manual Installation

If the automatic import does not work, the Blueprint can also be installed manually.

  1. Open the Blueprint YAML file in the repository.

  2. Copy the complete YAML content.

  3. In Home Assistant, go to:

    Settings → Automations & Scenes → Blueprints
    
  4. Select Import Blueprint.

  5. Paste the following raw YAML URL:

    https://gitea.kskovmose.dk/Kasper/HAOS/raw/branch/main/Blueprints/outdoor_light.yaml
    
  6. Confirm the import.

  7. Create a new automation from the Blueprint.

  8. Configure the desired settings.

Configuration Example

A simple configuration could be:

Lights:
    Outdoor lights

Evening elevation:
    -4°

Morning elevation:
    -4°

Night Off:
    Enabled

Night Off Time:
    23:00

Morning On:
    Enabled

Morning On Time:
    05:30

Notes

Sun Elevation

Sun elevation is measured in degrees relative to the horizon.

Positive elevation
       │
       │       ☀️ Sun
       │
───────┼──────────── Horizon (0°)
       │
       │
       ▼
Negative elevation

Using a negative elevation such as -4° means that the sun is already below the horizon.

This makes the automation independent of fixed clock times and automatically adapts throughout the year.

Limitations

The blueprint currently does not:

  • Change brightness depending on time of day
  • Use transitions when turning lights on/off
  • Detect manual changes to the lights
  • Restore the previous light state
  • Use weather or cloud conditions
  • Use different lights for evening and morning

Changelog

v1.0

  • Initial release
  • Evening activation using sun elevation
  • Configurable night shutdown
  • Optional morning activation
  • Morning shutdown based on sun elevation
  • Optional enable entity
  • Support for multiple lights