Addressable Lambda Effect with dynamic update_interval

Hello,

I’ve made an addressable lambda effect for a night light for my son. A block of four LEDs moves from end to beggining of the stripe. If it reaches the first four LEDs the stripe starts to activate all LEDs of the stripe step by step. I’m very proud, because this was my first project. And it works!

But now I have a new idea. By starting the effect it should calculate the update interval so that it reaches the first four LED at 6:30 AM. At this time it should recalculate the update_interval to reach the complete activated stripe at 6:45 AM.

But honestly, I have no idea how to? Hope for your help…

Here is the effect code:

light:
  - platform: neopixelbus
    type: GRB
    variant: WS2812
    pin: D4
    num_leds: 59
    name: "Schreibtisch-LED"
    id: schreibtisch_led
    effects:
      - addressable_lambda:
          name: "Nachtlicht"
          update_interval: 1s
          lambda: |-
            static int step = 0;
            static int led = 60;
            if(initial_run) {
              it.range(0, 55) = ESPColor(0, 0, 0);
              it.range(56, 59) = ESPColor(255, 153, 51);
              step = 0;
              led = 60;
            }
            if (led > 4 && step < 1) {
              it[led] = ESPColor(0, 0, 0);
              it[led - 4] = ESPColor(255, 153, 51);
              led = led - 1;
            }
            if(led <= 4 && step < 1){
              it.range(1, 4) = ESPColor(255, 153, 51);
              it.range(5, 60) = ESPColor(0, 0, 0);
              step = step + 4;
            }
            if(led <= 4 && step >= 1){
              it[step] = ESPColor(255, 153, 51);
              step = step + 1;
            }
            if(led <= 4 && step == 59){
              it.all() = ESPColor(255, 153, 51);
            }

@eddingthestift:

I tried the same and well the ‘update_interval’ cant be changed dynamically.
You could try counting steps and change the LED status e.g. only every 10 intervals. Based on your update_interval.
Maybe after some time this gets inaccurate.
Second idea would be to combine the time function with your lambda function.
I currently focus on something else so I cannot try it by myself.