How do I get a colourful RGB LED strip with esphome?

Hello,
I have built a showcase lighting system with a Wemos D1, esphome and an RGB LED strip.
Switching the light on and off works very well and I can also set the colour in HomeAssistant.
However, I would like the RGB LEDs to be coloured. I.e. when I switch on the light (whether by button or by HA) it should be coloured directly.
By this I mean that the 1st LED should be red, the 2nd LED blue, the 3rd LED green, the 4th LED red again, the 5th LED blue and so on.
But I can’t get it right …

This is my code:

light:
  - platform: rgb
    name: "Schuhschrank - RGB"
    id: light_rgb
    red: output_component1
    green: output_component2
    blue: output_component3
  - platform: binary
    name: "Schuhschrank - UV"
    id: light_uv
    output: uvlight_output

output:
  - platform: esp8266_pwm
    id: output_component1
    pin: D7
  - platform: esp8266_pwm
    id: output_component2
    pin: D5
  - platform: esp8266_pwm
    id: output_component3
    pin: D0
    max_power: 95%
  - id: uvlight_output
    platform: gpio
    pin:
      number: D2

binary_sensor:
  - platform: gpio
    pin:
      number: D3
      mode: INPUT_PULLUP
      inverted: True
    name: "Schuhschrank - Schalter UV"
    id: uv_wechselschalter_sensor
    filters:
      - delayed_on: 10ms
    on_press:
      then:
        - light.toggle: light_uv
  - platform: gpio
    pin:
      number: D4
      mode: INPUT_PULLUP
      inverted: True
    name: "Schuhschrank - Schalter RGB"
    id: rgb_wechselschalter_sensor
    filters:
      - delayed_on: 10ms
    on_press:
      then:
        - light.toggle: light_rgb

I would look into installing WLED on the controller. A lot more control of the led strip. Then you can integrate into HA.

Is there no way to achieve this with “home made” solutions and a little less effort?
The coloured LEDs should also work without HA, only with the existing buttons.

I’m not sure, but WLED installs on the D1, and you just use the WLED integration instead of esphome.

I want to do it with “light.addressable_set” but it does’t work.
Anybody knows a solution with this?

I second the WLED route, it is dead simple and integrates well with HA.
WLED is definitely a “home made” solution

What happens when you switch on the LED strip? If I recall correctly you should get a color-wheel where you can set the color of the strip. But only after the LED’s are turned on.

After re-reading your post I realized that you are able to turn on the light and control the color. If you want to control the color “directly” you should be able to do service call turning on the lights, set brightness and colors.

You can configure WLED to run any preset you create when you turn the LED’s on.
If you want the LED’s to do something special, create the preset, then apply it as the boot preset.

I agree that wled is the best way to do this, but it is doable with esphome too.

However it really depends what leds you have. It doesn’t look like yours are individually addressable. It would help if you told us exactly what you are driving with the ESP.

I took another close look at the LED strips.
There are 4 x pins, 1 x 5V, 1 x R, 1 x G, 1 x B.
So it seems to be true that the LEDs are not individually addressable.
Switching to WLED is out of the question because sooner or later other extensions will be operated on the Wemos D1.

It wouldn’t do you much good for analog lights anyway.

WLED can run these now though.

That’s the only way I use WLED.

WLED is seriously less effort, and none of my displays are integrated with Home Assistant.

1 Like

Yes I know, but wled won’t make the leds individually addressable, and there really is no advantage that I can see over having wled over esphome for @Mausbiber’s leds.

Very true.

Indeed. Beeing the led strip analog its better esphome.
And with esphome the other pins can be used like f.i. a motion sensor, temp etc…

which extensions (motion sensors, temperature sensors, displays etc) you will need in future? If you need any one of these listed on this page you can still use wled. WLED-wemos-shield/resources/Firmware/WLED_wemos_shield/v0.13.2-a0 at master · srg74/WLED-wemos-shield · GitHub

Check this thread Heat sensor - #4 by blazoncek - Hardware - WLED

Dimming non-addressable 12V led lights - #15 by yousaf465 WLED does give you more control when it comes to non-addressable/analog leds

I have the same model of LEDs on 2 esp32. One is running esphome with different sensors and the other is on wled. WLED one gives me better control of the led along with standalone automation (without writing any further configuration). WLED has it own app + webserver, while esphome have a webserver only .