Setting an rgb color with ESPHome

I have some of the original BRUH multisensors using the esp8266 from back when it originally was created utilizing mqtt. Now I am trying one with the ESPHome and it works fine accept one thing. I cannot figure out how to change the color of the rgb led to different colors based on different events triggered. I can turn it on/off but nothing with sending a command for color. The manual color wheel selector works fine though.

Any insight is greatly appreciated.

Without knowing the exact details of your config - normally colours are set in the light.turn_on: action. To change colours, just call light.turn_on: again.

And if you meant to post this as a question about controlling from HA (rather than ESPHome), service: light.turn_on

2 Likes

From HA’s point of view you do it exactly the same as any other light, via the service @zoogara mentioned.

1 Like

Turning the rgb light on and off is no issue. I just cannot find anything about setting specific colors.

output:
  - platform: esp8266_pwm
    pin: D1
    id: redgpio
  - platform: esp8266_pwm
    pin: D2
    id: greengpio
  - platform: esp8266_pwm
    pin: D3
    id: bluegpio

light:
  - platform: rgb
    name: "Pantry Light"
    red: redgpio
    green: greengpio
    blue: bluegpio


Prior to ESPHome when I was using MQTT I would send a payload like:

{"state":"ON","brightness":"255","color":{"r":"255","b":"0","g":"0"}}

to the appropriate topic. With ESPHome I cannot find any specific command for colors.

Do you mean setting colour from esphome or from ha? Either way you have been given the correct answer, but before we expand on it, tell is exactly what you are doing.

Perhaps you missed the docs @zoogara pointed to, because they are pretty specific.

1 Like

Thanks everyone. I forgot I would have to do this as a service call. I was trying to do it as a device, which only allows ON/OFF. Still trying to get use to the menu driven configurator instead of just entering everything in by hand in the configuration.yaml. Again thanks for your patience and help.