How to make a sunrise light effect on esphome?

hi guys is any one has made a sunrise effect using esphome , im trying to understand the lamba effect without luck

What have got so far.

i get desperate and delete all of it, been trying for hours and a many many effects

If you don’t have an ESPHome configuration to share what you have tried, please at least describe the physical configuration of your device including the type of board you are using and the type of leds as well as any additional circuit components.

As well as a description of what you want this effect to do.

let me explain , im using a esp8266 to turn my light in my aquarium , i want to make a sunrise effect that start with a RGB led strip (ws2812B) from dark blue to white to simulate a sunrise and the after the effect stop turn on a relay in the same esp8266 and turn off the led strip ,

this is one of my test trying to make it work

light:
  - platform: fastled_clockless
    rgb_order: GRB
    pin: GPIO15
    num_leds: 200
    name: "led pecera"
    chipset: ws2812B
    id: my_light
    effects:
      - lambda: 
          name: amanecer 
          update_interval: 3s 
          lambda: |- 
            static int state = 0; 
            auto call = id(my_light).make_call(); 
            call.set_transition_length(3000); 
            if (state == 0) { 
              call.set_rgb(0,0,1.0);  
              call.set_brightness(0.15);
            } else if (state ==1) {
              call.set_rgb(0.25,0.0,1.0); 
              call.set_brightness(0.40);
            } else if (state ==2) { 
              call.set_rgb(0.5,0.0,1.0);
              call.set_brightness(0.60);
            } else if (state == 3) { 
              call.set_rgb(0.75,0,1.0);
              call.set_brightness(0.80);
            } else if (state == 4) { 
              call.set_rgb(1.0,0,1.0);
              call.set_brightness(1.0);
            } else if (state == 5) { 
              call.set_rgb(1.0,0,0.75);
            } else if (state == 6) { 
              call.set_rgb(1.0,0,0.5);
            } else if (state == 7) { 
              call.set_rgb(1.0,0,0.25);
            } else if (state == 8) { 
              call.set_rgb(1.0,0,0);
            } else if (state == 9) { 
              call.set_rgb(1.0,0.25,0);
            } else if (state == 10) { 
              call.set_rgb(1.0,0.5,0);
            } else if (state == 11) { 
              call.set_rgb(1.0,0.75,0);
            } else if (state == 12) { 
              call.set_rgb(1.0,1.0,0.25);
            } else if (state == 13) { 
              call.set_rgb(1.0,1.0,0.50);
            } else if (state == 14) { 
              call.set_rgb(1.0,1.0,0.75);
            } else if (state == 15) { 
              call.set_rgb(1.0,1.0,1.0);
            } 

            call.perform(); 
            state += 1; 
            if (state == 16){
              call.set_effect("None");
              state = 0;
           //   then:
           //     - switch.turn_on: luz_50
            }
        
          
switch:
  - platform: gpio
    name: "luz pecera 50%"
    pin: GPIO12
    id: luz_50
    inverted: true
  - platform: gpio
    name: "luz pecera 100%"
    pin: GPIO13 
    inverted: true

Does the led work in a very simple way, ie without all that effect code?

yes, my problem is after the effect is done and turn off , the transition is still working on the background even when the led is turn off

and getting this error on the log

    effects:
      - lambda: 
          name: amanecer 
          update_interval: 1s 
          lambda: |- 
            static int state = 0; 
            auto call = id(my_light).make_call(); 
            call.set_transition_length(1000); 
            if (state == 0) { 
              call.set_rgb(0,0,1.0);  
              call.set_brightness(0.15);
            } else if (state ==1) {
              call.set_rgb(0.25,0.0,1.0); 
              call.set_brightness(0.40);
            } else if (state ==2) { 
              call.set_rgb(0.5,0.0,1.0);
              call.set_brightness(0.60);
            } else if (state == 3) { 
              call.set_rgb(0.75,0,1.0);
              call.set_brightness(0.80);
            } else if (state == 4) { 
              call.set_rgb(1.0,0,1.0);
              call.set_brightness(1.0);
            } else if (state == 5) { 
              call.set_rgb(1.0,0,0.75);
            } else if (state == 6) { 
              call.set_rgb(1.0,0,0.5);
            } else if (state == 7) { 
              call.set_rgb(1.0,0,0.25);
            } else if (state == 8) { 
              call.set_rgb(1.0,0,0);
            } else if (state == 9) { 
              call.set_rgb(1.0,0.25,0);
            } else if (state == 10) { 
              call.set_rgb(1.0,0.5,0);
            } else if (state == 11) { 
              call.set_rgb(1.0,0.75,0);
            } else if (state == 12) { 
              call.set_rgb(1.0,1.0,0.25);
            } else if (state == 13) { 
              call.set_rgb(1.0,1.0,0.50);
            } else if (state == 14) { 
              call.set_rgb(1.0,1.0,0.75);
            } else if (state == 15) { 
              call.set_rgb(1.0,1.0,1.0);
            } 
            if (state == 16){
              call.set_effect("None");
              call.set_state(false);
              id(luz_50).turn_on();
              call.perform();
              state = 0;
            }else{
              call.perform();
              state += 1;
            }
[20:54:14][W][light:290]: 'led pecera' - Effect cannot be used together with transition/flash!
[20:54:14][W][light:321]: 'led pecera' - Cannot start an effect when turning off!

well i manage to make a few effects this are my examples

light:
  - platform: fastled_clockless
    rgb_order: GRB
    pin: GPIO15
    num_leds: 100
    name: "led pecera"
    chipset: ws2812B
    id: my_light
    effects:
      - lambda: 
          name: amanecer 
          update_interval: 10s 
          lambda: |- 
            static int state = 0; 
            auto call = id(my_light).make_call(); 
            call.set_transition_length(3000); 
            if (state == 0) { 
              call.set_rgb(0,0,1.0);  
              call.set_brightness(0.15);
            } else if (state ==1) {
              call.set_rgb(0.1,0,1.0); 
              call.set_brightness(0.40);
            } else if (state ==2) { 
              call.set_rgb(0.2,0.1,1.0);
              call.set_brightness(0.60);
            } else if (state == 3) { 
              call.set_rgb(0.3,0.1,1.0);
              call.set_brightness(0.80);
            } else if (state == 4) { 
              call.set_rgb(0.4,0.2,1.0);
              call.set_brightness(1.0);
            } else if (state == 5) { 
              call.set_rgb(0.5,0.4,1.0);
            } else if (state == 6) { 
              call.set_rgb(0.6,0.5,1.0);
            } else if (state == 7) { 
              call.set_rgb(0.7,0.5,1.0);
            } else if (state == 8) { 
              call.set_rgb(0.8,0.6,1.0);
            } else if (state == 9) { 
              call.set_rgb(0.9,0.7,1.0);
            } else if (state == 10) { 
              call.set_rgb(1.0,1.0,1.0);
            } 
            if (state == 11){
              id(luz_100).turn_on();
              call.set_effect("None");
              call.set_state(false);
              call.perform();
              state = -1;
            }
            
              call.perform();
              state += 1;
      - lambda: 
          name: atardecer 
          update_interval: 10s 
          lambda: |- 
            static int state = 0; 
            id(luz_100).turn_off();
            auto call = id(my_light).make_call(); 
            call.set_transition_length(3000); 
            if (state == 0) { 
              call.set_rgb(1.0,1.0,1.0);
              call.set_brightness(1.0);
            } else if (state ==1) {
              call.set_rgb(1.0,1.0,1.0);            
            } else if (state ==2) { 
              call.set_rgb(0.9,0.9,1.0);            
            } else if (state == 3) { 
              call.set_rgb(0.8,0.8,1.0);            
            } else if (state == 4) { 
              call.set_rgb(0.7,0.7,1.0);            
            } else if (state == 5) { 
              call.set_rgb(0.6,0.6,1.0);
            } else if (state == 6) { 
              call.set_rgb(0.5,0.5,1.0);
            } else if (state == 7) { 
              call.set_rgb(0.4,0.4,1.0);
            } else if (state == 8) { 
              call.set_rgb(0.3,0.3,1.0);
            } else if (state == 9) { 
              call.set_rgb(0.2,0.2,1.0); 
            } else if (state == 10) { 
              call.set_rgb(0.1,0.1,1.0);
            } else if (state == 11) { 
              call.set_rgb(0,0,1.0);
            } 
            if (state == 12){
              call.set_effect("None");
              call.perform();
              state = -1;
            }
            
              call.perform();
              state += 1;            
      - lambda: 
          name: anochecer 
          update_interval: 10s 
          lambda: |- 
            static int state = 0; 
            auto call = id(my_light).make_call(); 
            call.set_transition_length(3000); 
            if (state == 0) { 
              call.set_rgb(0,0,1.0);
              call.set_brightness(1.0);
            } else if (state == 1) { 
              call.set_brightness(0.9);
            } else if (state == 2) { 
              call.set_brightness(0.8);
            } else if (state == 3) { 
              call.set_brightness(0.7);
            } else if (state == 4) { 
              call.set_brightness(0.6);
            } else if (state == 5) { 
              call.set_brightness(0.5);
            } else if (state == 6) { 
              call.set_brightness(0.4);
            } else if (state == 7) { 
              call.set_brightness(0.3);
            } else if (state == 8) { 
              call.set_brightness(0.2);
            } else if (state == 9) { 
              call.set_brightness(0.1);
            }
            if (state == 10){
              call.set_effect("None");
              call.set_state(false);
              call.perform();
              state = -1;
            }
            
              call.perform();
              state += 1;         
          
      - addressable_lambda:
          name: "My Custom Effect"
          update_interval: 1s
          lambda: |-
              static int steps = 0;
              static int led = 50;
              static int led2 = 49;
              static int led3 = 50;
              static int led4 = 49;  
              static int led5 = 50;
              static int led6 = 49;                
              auto call = id(my_light).turn_on();


               if (steps >=0 && steps <= 50) { 
                  call.set_rgb(0.0, 0.0, 1.0);
                  call.perform();
                  it[led] = light::ESPColor(200, 100, 255);
                  it[led2] = light::ESPColor(200, 100, 255);
                  led += 1;
                  led2 -= 1;
                  steps += 1;

                  
               } 
               if (steps >=51 && steps <= 100) { 
                  it[led3] = light::ESPColor(200, 170, 255);
                  it[led4] = light::ESPColor(200, 170, 255);
                  led3 += 1;
                  led4 -= 1;                  
                  steps += 1;
               }   
               
               if (steps >=101 && steps <= 150) { 
                  it[led5] = light::ESPColor(255, 255, 255);
                  it[led6] = light::ESPColor(255, 255, 255);
                  led5 += 1;
                  led6 -= 1;                  
                  steps += 1;
               }                  
               
               
               if(steps >= 151){
                call.set_effect("None");
                call.set_rgb(1.0, 1.0, 1.0);
                call.perform();
                steps = 0;
                led = 50;
                led2 = 49;
                
               }
               

Hello, this feed is very interesting but sadly it lacks a bit more information for better understanding of what you achieved and how you successfully used the lambda effect :slight_smile: If you have time to comment on your code that would be great so that I could apply it to my own use case. Thanks in advance !