Creating a alarm clock

Hello!

This topic inspired me to my first HA project. I’m new to YAML but not really to coding in general and I can’t get my natural wakeup to work. My light cannot use “transition” so I decided to make a script out of it.

My setup in the dashboard looks like this (don’t mind 23:01, it’s for testing :grin: ):

I want to be able to choose for how long the light will transition into full brightness!
I’m going to do it in 10 steps with 10% brightness, 20% brightness etc… so the script has to fetch from the slider, how long time the delay between every increment is.

The script right now looks like this and are being called succesfully from the trigger. For the purpose of testing, I’m putting the value of the slider directly as the delay time:

script:
  wakeuplight_script_fade:
    alias: Wakeup Light Fading
    sequence:
      - alias: Wakeup Light 10
        service: light.turn_on
        entity_id: light.light1
        data:
          brightness: 40
      - delay:
          minutes: '{{ states.input_slider.wakeuplight_fade.state | int }}'
      [and then repeat the brightness increment]

The “wakeuplight_fade” is the fading time slider shown in the dashboard.
This script runs through without problem if I use an integer instead of the slider state.

Why can’t delay understand the slider state?

Best regards

2 Likes