[ Outdoor lights — sunset fade-in / overnight fade-out ]

[ Overview ]

Set up outdoor lights to come on automatically at sunset, ramp up
gradually as it gets darker, and fade back out before the set
overnight-off time.  Works with any smart bulb that supports brightness
and transitions — Govee, Philips Hue, LIFX, IKEA TRADFRI, Sengled,
ESPHome-flashed boards, the lot.

Two flavours of "ramp up" covered below:

  Simple fade   single long transition from ~0% to 100% over 30 minutes
                  starting at sunset.  Easy.  Works for most cases.
  Step fade     three stages: 20% at sunset → 60% at sunset+30min
                  → 100% at sunset+60min.  More natural — mimics how
                  outdoor lighting actually behaves as twilight deepens.

Both share the same fade-out + turn-off tail (fade to ~0% over 30
minutes starting at 23:30, full-off at midnight).  Pick one based on
how fussy you want the dusk transition to be; everything else is
identical.

This guide builds on the
outdoor-lights snippet on the
snippets page — that's the simple-fade variant as a single
copy-pasteable YAML block.  This page expands on it with the step-fade
alternative, full setup steps, a color reference, and a troubleshooting
table.

Also available as a blueprint.  The simple-fade variant ships as a
single-import HA blueprint
(writeup) —
three triggers + choose-dispatch wrapped as one automation, with
configurable color, brightness, durations, sunset offset, and an optional
sun-elevation gate so high-summer evenings don't kick the lights on while
it's still bright outside.  Use the blueprint if you want a UI-driven install
per light; use the manual YAML below if you want to read the whole pipeline
inline or need the step-fade variant (which the blueprint does not cover).

[ Prereqs ]

  Home Assistant with your location set correctly
     Settings → System → General → Country / Time zone
     The sunset trigger reads coordinates from here.  If your location
     is wrong, your "sunset" will be hours off.

  Smart lights that expose brightness and accept transitions
     Most modern smart bulbs do.  If a light doesn't support the
     transition parameter, the fade reduces to an abrupt step at
     each automation trigger — the schedule still works, just no
     gradient.

  A light group if you're controlling multiple bulbs together
     Optional but recommended.  Lets you target one entity instead of
     fanning out the same action across five copies of itself.

  File Editor or Studio Code Server add-on
     For editing configuration.yaml and automations.yaml
     directly.  The UI automation editor works for these too if you
     prefer click-driven configuration.

[ Light group (if you have multiple bulbs) ]

Skip this section if you're driving a single light entity already.

Two ways to create the group — UI or YAML.  Both produce the same
light.outdoor_lights entity that the automations below target.

UI path: Settings → Devices & Services → Helpers →
Add Helper → Group → Light Group.  Pick the bulbs to include
and give the group a name like "Outdoor Lights".

YAML path: append to configuration.yaml and restart HA.
# configuration.yaml
light:
  - platform: group
    name: Outdoor Lights
    entities:
      - light.outdoor_bulb_1
      - light.outdoor_bulb_2
      - light.outdoor_bulb_3

[ Pick an approach — simple vs step ]

The choice is purely about how the brightness ramp looks during the
first hour after sunset.  Everything else (fade-out, turn-off, color,
group target) is identical.

  Simple fade (2 automations)
     One long transition from ~0% to 100% over 30 minutes, starting at
     sunset.  Two-step trick — turn on at 1% (warming the bulbs up
     past their off-state floor), wait 5 seconds, then call turn_on
     again with the 1800-second transition.  Works around HA's
     "transitions don't apply when the light starts from off" quirk.

  Step fade (3+ automations)
     Three sunset-anchored triggers at +0, +30, +60 minutes — each
     ramps to a target brightness (20% → 60% → 100%) over
     15 minutes.  Looks more like real-world dusk behaviour: faint glow
     while there's still light in the sky, mid-brightness as twilight
     deepens, full-bright once it's actually dark.

Pick simple if you want a clean curve and minimal moving parts.
Pick step if you want the lights to FEEL like they belong to the time
of day rather than just "they came on at sunset."

[ Simple fade setup ]

Three automations: turn on with long fade, fade out before off-time,
turn off completely.  Paste into automations.yaml.
# Turn on at sunset with long fade-in
- id: 'outdoor_lights_sunset_on'
  alias: 'Outdoor: Lights On at Sunset'
  triggers:
    - trigger: sun
      event: sunset
  actions:
    - action: light.turn_on
      target:
        entity_id: light.outdoor_lights
      data:
        brightness_pct: 1          # Start nearly off
        rgb_color: [255, 147, 41]  # Warm amber -- change to your preferred color
    - delay:
        seconds: 5                 # Wait for light to initialize
    - action: light.turn_on
      target:
        entity_id: light.outdoor_lights
      data:
        brightness_pct: 100
        rgb_color: [255, 147, 41]
        transition: 1800           # Fade over 30 minutes (in seconds)
  mode: single

# Fade out before turn-off time
- id: 'outdoor_lights_fade_out'
  alias: 'Outdoor: Lights Fade Out'
  triggers:
    - trigger: time
      at: '23:30:00'              # Start fading 30 minutes before off time
  conditions:
    - condition: state
      entity_id: light.outdoor_lights
      state: 'on'
  actions:
    - action: light.turn_on
      target:
        entity_id: light.outdoor_lights
      data:
        brightness_pct: 1
        transition: 1800           # Fade over 30 minutes
  mode: single

# Turn off completely
- id: 'outdoor_lights_off'
  alias: 'Outdoor: Lights Off at Midnight'
  triggers:
    - trigger: time
      at: '00:00:00'
  actions:
    - action: light.turn_off
      target:
        entity_id: light.outdoor_lights
  mode: single

[ Step fade setup ]

Five automations: three sunset-anchored stages, fade-out, off.  The
same fade-out + off pair from the simple variant gets reused.
# Stage 1 -- Sunset: dim warm glow
- id: 'outdoor_lights_stage1'
  alias: 'Outdoor: Stage 1 - Sunset Glow'
  triggers:
    - trigger: sun
      event: sunset
  actions:
    - action: light.turn_on
      target:
        entity_id: light.outdoor_lights
      data:
        brightness_pct: 1
        rgb_color: [255, 147, 41]
    - delay:
        seconds: 5
    - action: light.turn_on
      target:
        entity_id: light.outdoor_lights
      data:
        brightness_pct: 20
        rgb_color: [255, 147, 41]
        transition: 900            # Fade to 20% over 15 minutes
  mode: single

# Stage 2 -- 30 minutes after sunset: medium brightness
- id: 'outdoor_lights_stage2'
  alias: 'Outdoor: Stage 2 - Dusk'
  triggers:
    - trigger: sun
      event: sunset
      offset: "00:30:00"
  actions:
    - action: light.turn_on
      target:
        entity_id: light.outdoor_lights
      data:
        brightness_pct: 60
        rgb_color: [255, 147, 41]
        transition: 900
  mode: single

# Stage 3 -- 60 minutes after sunset: full brightness
- id: 'outdoor_lights_stage3'
  alias: 'Outdoor: Stage 3 - Full Dark'
  triggers:
    - trigger: sun
      event: sunset
      offset: "01:00:00"
  actions:
    - action: light.turn_on
      target:
        entity_id: light.outdoor_lights
      data:
        brightness_pct: 100
        rgb_color: [255, 147, 41]
        transition: 900
  mode: single

# Fade out 30 minutes before off time
- id: 'outdoor_lights_fade_out'
  alias: 'Outdoor: Lights Fade Out'
  triggers:
    - trigger: time
      at: '23:30:00'
  conditions:
    - condition: state
      entity_id: light.outdoor_lights
      state: 'on'
  actions:
    - action: light.turn_on
      target:
        entity_id: light.outdoor_lights
      data:
        brightness_pct: 1
        transition: 1800
  mode: single

# Turn off completely
- id: 'outdoor_lights_off'
  alias: 'Outdoor: Lights Off at Midnight'
  triggers:
    - trigger: time
      at: '00:00:00'
  actions:
    - action: light.turn_off
      target:
        entity_id: light.outdoor_lights
  mode: single

[ Color options ]

Replace the rgb_color value above with whatever fits the look
you're after.  Warm amber is the default in the YAML because it matches
the sodium-vapour streetlight aesthetic and doesn't carry blue light
into bedroom windows.

  Color         RGB                 Best for
  ——————————————————————————————————————————————————————
  Warm amber    [255, 147, 41]      Tropical, cozy — recommended default
  Soft white    [255, 200, 150]     Clean, neutral
  Coral sunset  [255, 100, 80]      Tropical sunset vibe
  Cool white    [200, 220, 255]     Modern, security-style
  Soft green    [50, 200, 50]       Blends with garden / plants

If your lights support color temperature directly (most CCT bulbs do),
use color_temp instead of RGB — sharper warm hue with no chance
of the bulb getting confused between RGB approximation and native
white channels:
color_temp: 2700        # Warm white. Range: 2200-2700 warm, 4000-6500 cool

[ Install ]

  1. Open File Editor from the HA sidebar (or any editor pointed
     at your HA config directory)
  2. Navigate to /config/automations.yaml
  3. Paste your chosen variant at the bottom
  4. Save the file
  5. Go to Developer Tools → YAML → Automations → Reload
     (no full restart needed for automation reload)

You can also use the UI's automation editor to import the YAML —
copy the block, then Settings → Automations & Scenes → +
Create automation → Edit in YAML and paste.

[ Customization tips ]

Change the off-time — bump the at: in the fade-out and
turn-off automations to your preferred wind-down hour.  Always set the
fade-out 30 minutes before the off-time so the transition has room.

Adjust transition speedtransition is in seconds.
1800 = 30 min, 900 = 15 min, 300 = 5 min.  Less than 60 seconds and the
ramp starts to look jumpy on most bulbs.

Start before sunset — the sun trigger accepts a negative
offset to fire earlier than astronomical sunset (useful if your house
sits in a valley or behind a building that loses direct sun before
official sunset):
- trigger: sun
  event: sunset
  offset: "-00:20:00"     # 20 minutes BEFORE sunset
Only run when someone is home — add a
conditions: block to each automation to gate on presence:
conditions:
  - condition: state
    entity_id: person.your_name
    state: home
Skip on bright summer evenings — check the sun's elevation
so lights only kick in when the sky is actually dark enough to need
them.  Elevation 3 degrees and below is roughly civil twilight onset:
conditions:
  - condition: numeric_state
    entity_id: sun.sun
    attribute: elevation
    below: 3

[ Troubleshooting ]

  Symptom                          Fix
  —————————————————————————————————————————————————————————————————————————
  Light turns on but doesn't       Bulb doesn't support transitions.
  fade                              Check manufacturer specs.  Most
                                    name-brand smart bulbs do; some
                                    generic / older firmware doesn't.

  Automation doesn't trigger       Verify location in Settings → System
                                    → General.  Sunset triggers
                                    read coordinates from there.

  Wrong sunset time                 Same location panel — check the
                                    timezone too.  HA's clock and the
                                    OS clock can disagree if you've
                                    moved a backup between hosts.

  Light flickers at start          Bump the initial delay: seconds: 5
                                    to 10.  Some bulbs take longer than
                                    others to settle into a transition
                                    starting state.

  Fade-out doesn't reach zero      Some bulbs have a brightness floor —
                                    1% is "as dim as I go" but isn't
                                    actually off.  Add an explicit
                                    light.turn_off action after
                                    the transition completes, or rely
                                    on the midnight off automation to
                                    do the cleanup.

  Lights re-trigger during the     The fade-out's state condition
  fade-out                          guards against this in the YAML
                                    above (state: 'on').  If you
                                    see re-triggers, double-check that
                                    condition didn't get edited out.

[ See Also ]