Controlling RGB LED with Home Assistant and ESPHOME

Just getting started with ESPHOME and I’ve managed to get a Wemos D1 running with a couple of LED’s that I can control from HA. However, I wanted to swap them over to a RGB LED similar to the following

I haven’t been able to find any examples other than setting up LED strips. I’ve configured switches so far for the standard LED’s similar to the following;

switch:
  - platform: gpio
    pin: D1
    name: "Playing VR"
  - platform: gpio
    pin: D2
    name: "Playing Game"    

This exposes two switches in HA which I can control.

Would appreciate if someone could give me some pointers on how to set up the RGB LED.

Thanks

light:
  - platform: rgb
    name: "RGB LED"
    red: output_red
    green: output_green
    blue: output_blue


output:
  - platform: esp8266_pwm
    id: output_red
    pin: D5
  - platform: esp8266_pwm
    id: output_green
    pin: D6
  - platform: esp8266_pwm
    id: output_blue
    pin: D7
4 Likes

Works perfectly. Thanks.

1 Like

Hi,

I was just looking for something to create a front end control for my RAKO controlled LED’s along the same lines. So basically, within RAKO I have 4 channels for an RGBW strip. They are showing in HA under the RAKO integration .

I used the example above to try and add an RGB light to HA to give me a consolidated colour wheel control over these as follows:

light:
  - platform: rgb
    name: "Cinema Ceiling LED"
    red: light.cinema_2_red
    green: light.cinema_2_green
    blue: light.cinema_2_blue

However, upon validation I get:

Platform error light.rgb - Integration ‘rgb’ not found.

I suspect maybe there is something else I need to add, or maybe the construct under 2022.11.2 is different. Are you able to give any pointers?

Thanks
Barry