WLED Wake up light

Good morning guys,

I’m trying to build a wake up light using an ESP8266 with WLED, and a WS2812 LED strip. I have the WLED strip talking with Home Assistant and everything is working as expected.

My problem is that all the automations/scripts I find rely on the transition time. And WLED only supports transition times up to 60 seconds.

Do any of you guys have an idea as to how a wake up light could be implemented with WLED?

You could implement a while loop that increases the brightness slightly and has a delay in the loop as long as you like. You could increment the colour temperature in the same loop.

Look at the night light feature, I could be wrong but I believe it can be made to turn the light on to X brightness slowly over a long time frame from fully off.

I will look into that later today. Think you are right. The night light mode can be inverted to work as a sunrise feature.

So, partial succes. If I activate the night light feature from the wled web interface it works! Makes a great sunrise. But if I activate it from the home assistant wled night light switch, it skips the fade in part of the sunrise :sun_with_face:.

- while: "{{ repeat.index < 255 }}"
  sequence:
    - service: light.turn_on
      data:
        entity_id: light.your_light
        brightness_step: 5
    - delay: 60

This will increase the brightness by 5 every minute until 100% (255). This takes 51 minutes. Feel free to adjust the delay or step values. e.g. 30s delay gets you full brightness in 25.5 minutes.

For a more realistic sunrise that starts as an orangy light and progresses to a bright blueish white you could adjust the colour temperature at the same time:

- service: light.turn_on
  data: 
    entity_id: light.your_light
    brightness: 5
    color_temp: 2500
- delay: 60
- while: "{{ repeat.index < 255 }}"
  sequence:
    - service: light.turn_on
      data:
        entity_id: light.your_light
        brightness_step: 5
        color_temp: "{{ state_attr('light.your_light', 'color_temp')|int + 69 }}"
    - delay: 60

With a step size of 5, 255/5 = 51 steps.
51*69 =~ 3500.
2500 + 3500 = 6000

So the color temperature goes from 2500 to 6000 as the brightness increases.

Thanks! Looks really good. But i’m really after the sunrise effect that WLED has.

But i think I might have it nailed. Instead of toggling the night light button, I call the sunrise effect. The speed I set then defines the wake up time.

So the code below gives me a 5 minute sunrise.

action:
  - service: wled.effect
    entity_id: light.soverum
    data:
      effect: Sunrise
      speed: 5
mode: single

Invalid config for [automation]: [while] is an invalid option for [automation]. Check: automation->action->2->while. (See ?, line ?).

  action:
    - service: light.turn_on
      data:
        brightness_pct: 20
        entity_id: light.rom1
    - delay: 60
    - while: "{{ repeat.index < 255 }}"
      sequence:
        - service: light.turn_on
          data:
            entity_id: light.rom1
            brightness_step: 10
        - delay: 60    
  mode: single

Compare the documented syntax to your attempt. https://www.home-assistant.io/docs/scripts#while-loop

Please help, Now - Invalid config for [automation]: [sequence] is an invalid option for [automation]. Check: automation->sequence. (See ?, line ?).

  action:
    - service: light.turn_on
      data:
        brightness_pct: 20
        entity_id: light.rom1
    - delay: 60
  sequence:
    - service: light.turn_on
      repeat:
        while: "{{ repeat.index < 255 }}"
      data:
        entity_id: light.rom1
        brightness_step: 10
    - delay: 60    
  mode: single

or

  action:
    - service: light.turn_on
      data:
        brightness_pct: 20
        entity_id: light.spisebord_lys
    - delay: 60
      sequence:
        - service: light.turn_on
          repeat:
            while: "{{ repeat.index < 255 }}"
          data:
            entity_id: light.spisebord_lys
            brightness_step: 10
        - delay: 60    
  mode: single

None of your attempts are following the exapmle laid out in the documents:

      - repeat:
          while:
            - condition: template
              value_template: "{{ repeat.index <= 20 }}"
          sequence:
            - service: script.something

Thank you very much :grinning: Now working fine.

This is exactly what I am looking for. But I can’t get this to run on my HomeAssistant as an Automation. Do I need something special to get the service “wled.effect”? It is not avaiable for me.
WLED is already integrated into HomeAssistant. I am using D1 mini with an WS281B LED stripe (120 LEDs).

Error message:

Error running action
Unable to find service wled.effect

I tried to edit the automation yaml, but it was not working :frowning:

This is how I did it

action:
  - service: light.turn_on
    target:
      entity_id: light.wled_2
    data:
      effect: Sunrise
  - service: number.set_value
    target:
      entity_id: number.wled_intensity
    data:
      value: 155
  - service: number.set_value
    target:
      entity_id: number.wled_speed_2
    data:
      value: 3
mode: single

WLED’s short transition duration limitation has always bothered me, so I’ve fixed it to support transitions of up to 24h.

Regrettably, the WLED maintainers have refused to support longer transition times at all, so the fix I’ve made has not been merged into the official WLED release.

That said, I run my patched version on several WLED instances and have found it works well. With the patch applied, long transitions initiated from Home Assistant work perfectly with no other changes needed, and you need none of the unpleasant workarounds mentioned in this thread.

I’ve posted WLED binaries with the patch here.

Caveat: If you use WLED’s native sync feature, long transitions aren’t supported. Synced devices remain limited to 65s. Control each WLED device from HA instead.