Default light effect on turn on

I am trying to implement a default turn on state for some RGB LED strips.
I have some effects setup that I can access from the dashboard and work well.

I want to setup a default effect (Slow Random Colours) when the strips are turned on but having trouble with the on_turn_on action.

I have tried various combinations of code but cant get it to validate.

  - platform: rgb
    name: "LED Strip"    
    id: led_strip
    red: red
    green: green
    blue: blue
      - random:
          name: "Slow Random Colours"
          transition_length: 30s
          update_interval: 30s
      - random:
          name: "Fast Random Colours"
          transition_length: 4s
          update_interval: 5s

     - random:
        name: "Fast_Random_Colours"
         transition_length: 4s
         update_interval: 5s

What is the error message?

ERROR Error while reading config: Invalid YAML syntax:

while parsing a block mapping
  in "/config/esphome/RGB Feature Light.yaml", line 90, column 9:
            name: "FastRandomColours"
expected <block end>, but found '<block mapping start>'
  in "/config/esphome/RGB Feature Light.yaml", line 91, column 10:
             transition_length: 4s

After your on_turn_on trigger you need to use the light_turn_on action to set the effect.

      - light_turn_on: 
          id: led_strip
          effect: "Fast Random Colours"
1 Like

Thanks, that solved my problem I appreciate the help.
Not being a programmer, some of the documentation isn’t always obvious.

Didn’t work straight away but noticed the typo.


Thanks again.


An old post, but on the same topic: is there an easy way of setting a default colour/brightness etc after the initial turn on (eg ESPxxxx module reboot) only?

I’m successfully using on_turn_on to set colour and brightness. I would like to be able to turn the LED strip off/on from HA without altering settings but have a module boot-up default to a standard setting - on_turn_on appears to execute under both scenarios. Possibly there’s a lambda option but either there isn’t or I haven’t got the syntax correct.

On reboot you want on_boot:

Ah - thankyou, as simple as that! I searched everywhere under the light component options and tried complicated lambdas, but logically it’s part of the ESPxxxx core config not light control.

Code works now as expected.