NodeMcu ws2812b effect on "on state"

Hi. I’m fighting with this hardware to make in turn on and set effect automaticaly but I can’t figure it out. I have it work but I have to change effect manualy in a frontend. Could You please point me in a right direction or have example config as I’m novice in this matters.

Thank you.

You’ll have to share what you did and what you expected it to do.
See other answers as examples

   esphome:
  name: kuchnia_led1
  platform: ESP8266
  board: nodemcuv2

wifi:
  ssid: ""
  password: ""

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

light:
  - platform: fastled_clockless
    chipset: WS2812B
    pin: GPIO03
    num_leds: 8
    id: light_1
    rgb_order: GRB
    name: "FastLED Light"
    effects:
      - addressable_rainbow:
      - addressable_rainbow:
          name: bow
          speed: 10
          width: 50
      - addressable_flicker:
      - addressable_flicker:
          name: Flicker Effect With Custom Values
          update_interval: 16ms
          intensity: 5%

what I couldn’t do is to make effect “rainbow” start when I turn on the light switch. Pls help.

Thank you

Si flicker is working?

it works but not when I turn on the switch in front end I still have to choose effect from the list.

I made some change I have added:

 api:
  services:
    - service: start_effect
      variables:
        my_effect: string
      then:
        - light.turn_on:
            id: light_1
            effect: !lambda 'return my_effect;'

So I can call this action from ha automation, but I wish It start automaticaly.

wow got it working by doing:

light:
  - platform: fastled_clockless
    chipset: WS2812B
    pin: GPIO03
    num_leds: 8
    id: light_1
    rgb_order: GRB
    effects:
      - addressable_rainbow:
      
switch:
  - platform: template
    name: "Kitchen Light Led"
    optimistic: True
    turn_on_action:
        - light.turn_on:
            id: light_1
            effect: "Rainbow"
    turn_off_action:
        - light.turn_off:
            id: light_1    

Thak You guys, I hope it will help some one like me :slight_smile:

Great. Thanks for sharing. Takes a bit of time to nail it sometimes.
That switch you setup there is quite common. Whenever you want to activate something with a switch from ha that does not fit straightforward in esphome you resort to use that pattern.

It took me 2 days :slight_smile:

Thank You

you could also do this in your HA side service call. That way the NodeMCU isn’t interanlly limited to only turning on with that effect.

in your HA automation / script yaml

service: light.turn_on
data:
  entity_id: light.fastled_light #(you might want to change this to kitchen or whatever)
  effect: rainbow

Ok. Thank you for sugestions. It works now :+1: