I'm trying to learn ESPhome and using an ESP32 board to control a single/individual RGB LED, not an LED strip. I want to be able to use a script to turn on the LED to all white by gradually raising the brightness from off to full brightness over about a three second period. Then, I want to dim it to off and have it raise the brightness again only this time with the color red.
I've started out by just trying to program the board to create a device in HA, which I have done with the following code:
sphome:
name: riser-rgb-control
friendly_name: Riser RGB Control
compile_process_limit: 1
esp32:
board: esp32dev
framework:
type: esp-idf
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "*****"
ota:
- platform: esphome
password: "*****************"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Riser-Rgb-Control"
password: "************"
captive_portal:
light:
- platform: rgb
name: "My Riser LEDs"
red: output_red
green: output_green
blue: output_blue
output:
- platform: ledc
pin: GPIO23
id: output_red
inverted: false
- platform: ledc
pin: GPIO22
id: output_green
inverted: false
- platform: ledc
pin: GPIO21
id: output_blue
inverted: false
This has created a device, but it only has one control, which I can use to turn the whole unit (all three LEDs) on or off. What do I need to do to control each of the legs individually?