Home Assistant Guide

Simple tutorials for powerful automations

Wake Light: Gradually Brighten a Light in Home Assistant

This Home Assistant script allows you to create a smooth, customizable "sunrise" effect on any smart light. The light will gently ramp up its brightness over a chosen period - perfect for a gentle wake-up or creating the ideal morning ambiance.

What Does This Script Do?

This script will:

  • Start with the selected light turned off.
  • Gradually increase the brightness in small steps over your chosen duration.
  • Reach your specified target brightness by the end of the wake-up period.
  • Let you choose which light to use, how long the "sunrise" should last, and the final brightness, all from the Home Assistant UI.

How to Use This Script

  1. Add the Script: Copy the YAML below into your Home Assistant scripts editor (settings -> Automations & Scenes -> scripts -> Create -> 3 dot menu -> "Edit as YAML").
  2. Configure the Fields:
    • Light: Select the smart light you want to gradually brighten.
    • Duration: Choose how long the sunrise should last (for example, 30 minutes).
    • Target Brightness: (Optional) Set the maximum brightness percentage to reach. Defaults to 100%.
  3. Call the Script: Trigger the script manually or use it in an automation (e.g., at your wake-up time).

Tip: You can also use this effect in the evening by setting a lower target brightness for a gentle wind-down!

Use Cases & Ideas

  • Simulate a sunrise to wake up gently without sound.
  • Prepare the room for your morning routine automatically.
  • Wind down in the evening with a slow fade to a warm light.
  • Use as a "get ready" timer for kids or reminders (e.g., slowly bring up the lights when it's time to leave).

Script YAML


alias: Wake Light
fields:
  light:
    selector:
      entity:
        filter:
          domain: light
    description: The light to gradually brighten
    required: true
  duration:
    selector:
      duration: {}
    description: The total duration over which the light brightens
    required: true
  target_brightness:
    selector:
      number:
        min: 1
        max: 100
    name: Target Brightness (Percent)
    description: >-
      The brightness level to reach by the end of the wake period (in percentage)
    default: 100
    required: false
sequence:
  - target:
      entity_id: "{{ light }}"
    action: light.turn_off
  - variables:
      step: 2
      steps: "{{ (target_brightness // step) | int }}"
      total_duration_seconds: >
        {{ (duration.hours | int * 3600) + (duration.minutes | int * 60) + (duration.seconds | int) }}
      delay_seconds: "{{ (total_duration_seconds / steps) | round(0) if steps > 0 else 0 }}"
  - repeat:
      count: "{{ steps }}"
      sequence:
        - target:
            entity_id: "{{ light }}"
          data:
            brightness_pct: >
              {{ (repeat.index * step)
                 if (repeat.index * step) < target_brightness
                 else target_brightness }}
          action: light.turn_on
        - delay:
            seconds: "{{ delay_seconds }}"
  - target:
      entity_id: "{{ light }}"
    data:
      brightness_pct: "{{ target_brightness }}"
    action: light.turn_on
mode: single
description: ""