ESPHOME nodemcu-32s single rgb led config

Hi,
I’m trying to figure out how to configure 1 RGB led connected to nodemcu-32s board.
The RGB led I have is this: https://www.aliexpress.com/item/32833533425.html

I have got it connected as per this drawing: https://esp32io.com/images/tutorial/esp32-rgb-led-wiring-diagram.jpg

I’m trying to figure out what should be the esphome config now.

esphome:
  name: esp32-dev14

esp32:
  board: nodemcu-32s
  framework:
    type: arduino

logger:

api:
  encryption:
    key: "my_secret_password"

ota:
  password: "my_secret_other_password"

wifi:
  networks:
  - ssid: !secret wifi_ssid
    password: !secret wifi_password
  - ssid: !secret wifi2_ssid
    password: !secret wifi_password

captive_portal:

output:
  - platform: nodemcu-32s
    id: red
    pin: GPI23
    max_power: 80%
  - platform: nodemcu-32s
    id: green
    pin: GPI22
    max_power: 80%
  - platform: nodemcu-32s
    id: blue
    pin: GPI21
    max_power: 80%
light:
  - platform: rgb
    name: "RGB Satus LED"
    red: red
    green: green
    blue: blue
    

But this gives me ESPHOME error msg: Platform not found: output.nodemcu-32s
Is that the right approach? If so what should be the output platform?
Any suggestions?
Thanks

I think you want to use platform: gpio instead in the output section.

I cannot figure out the syntax - this is what I have:

light:
  - platform: rgb
    name: rgb
    red: red
    green: green
    blue: blue
  
output:
  - platform: gpio
    id: red
    pin: GPIO23
  - platform: gpio
    id: green
    pin: GPIO22
  - platform: gpio
    id: blue
    pin: GPIO21

but I’m getting this error:

light.rgb: [source /config/esphome/esp32-dev14.yaml:47]
  platform: rgb
  name: rgb
  
  ID 'red' of type gpio::GPIOBinaryOutput doesn't inherit from output::FloatOutput. Please double check your ID is pointing to the correct value.
  red: red
  
  ID 'green' of type gpio::GPIOBinaryOutput doesn't inherit from output::FloatOutput. Please double check your ID is pointing to the correct value.
  green: green
  
  ID 'blue' of type gpio::GPIOBinaryOutput doesn't inherit from output::FloatOutput. Please double check your ID is pointing to the correct value.
  blue: blue

Apologies, didn’t see that dependency. In that case - and because you are using an ESP32 - please try platform: ledc. That doe provide a float output. (If you were using an ESP8266, then platform: esp8266_pwm would be the way to go.)
And, while we’re on the topic, ledc outputs require a PWM capable pin. Luckily an ESP32 has many of those, and GPIO21/22/23 should be amongst them.

Perfect, thank you - I’ve got it working.

1 Like