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. This script will: Tip: You can also use this effect in the evening by setting a lower target brightness for a gentle wind-down! What Does This Script Do?
How to Use This Script
Use Cases & Ideas
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: ""