Initial effect for neopixel light

Hi, newbe here…
I have an esp32 with ESPHome, with a connected neopixel led strip, and I defined an effect. Everything good so far (can control it with HomeAssistant), but…

  • when i switch it on
  • select the efect
  • turn it off
  • turn it on again

The effect is lost (null).

How can I make my effect to be active by default, or restored after switching off/on

Been googling end experimenting for an hour without success…
A good tip would be apreciated!
Thanks, Hans.

You can use an automation with on_turn_on for the trigger and light.control for the action.

light:
  - platform: ...

    on_turn_on:
      then:
        - light.control:
          id: light_1
          effect: your_effect

Thanks Mike! That almost worked, but I had to indent some lines more, don’t understand why…
This is what have now:

light: 
  - platform: neopixelbus
    variant: WS2813
    type: GRB
    pin: GPIO16
    num_leds: 12
    name: "Led Strip"
    id: zorro
    default_transition_length : 0s
    
    on_turn_on:
      then:
        - light.control:
            id: zorro
            effect: "My Custom Effect"
          
    on_turn_off:
    - logger.log: "Light Turned Off!"
         
    effects:
        - addressable_lambda:
            name: "My Custom Effect"