Help with multiple rgb effects

If I follow the esphome guide for light effects and use the following code on my esp, how do I call the names random effects from home assistant automations?

  - platform: ...
    # ...
      # Use default parameters:
      - random:
      # Customize parameters
      - random:
          name: "My Slow Random Effect"
          transition_length: 30s
          update_interval: 30s
      - random:
          name: "My Fast Random Effect"
          transition_length: 4s
          update_interval: 5s

I know that I can issue a light.turn_on with effect: random but that only calls the first random effect. How do I call the other two that have names? I have tried calling the effect by name, but it doesn’t appear to work.


Hmm… I don’t have any lights in ESPHome… yet… :slight_smile: but I hope to eventually. From the docs, it looks like you have it correct:

With ESPHome’s light effects system you’re basically creating a bunch of entries for the effects dropdown in Home Assistant. If you wish to have several variants of the same effect you can of course also create multiple entries with each having a unique name

So what you could do to test is add the device to Home Assistant, and see what populates in the drop down… if it gets both of the effects you have in the configuration, you know that part is working.

If that is working confirm that the names are correct and that nothing was converted / truncated / etc. At this point I would diagnose the issue without automation and once everything works and is a known - then move into automation.

Good Luck!

Thanks. I followed your advice and was able to get it to work the way I wanted. Instead of calling “effect: random”, I called “effect: My Slow Random Effect” and it did what I wanted.

Thanks for your help.

1 Like