RGB Devices
RGB devices let you control light color from the mobile app or dashboard.
Requirementsโ
- ESP32 board
- RGB LED strip or bulb
- 3 free GPIO pins (R, G, B)
- Proper wiring with resistors or MOSFETs
Wiringโ
| Pin | ESP32 GPIO | Notes |
|---|---|---|
| R (Red) | GPIO 16 | Via MOSFET or resistor |
| G (Green) | GPIO 17 | Via MOSFET or resistor |
| B (Blue) | GPIO 18 | Via MOSFET or resistor |
| GND | GND | Common with ESP32 |
Add an RGB device (dashboard)โ
- Open Devices โ Add device
- Choose type: RGB Light
- Set GPIO pins for R, G, and B
- Set the ESP32 board name (e.g.
sala) - Save
The device id in the platform must match
idin the ESP32devices_configJSON.
Color controlโ
- Mobile app: tap the color circle on the device card โ pick a color โ Apply
- Dashboard: use the color picker next to the device
- Adjust R/G/B sliders or use presets
MQTT topicsโ
Control:
smarthome/{esp32_name}/rgb/{device_id}/set
Payload:
{"state":"ON","r":255,"g":128,"b":0}
State feedback:
smarthome/{esp32_name}/rgb/{device_id}/state
Preset colorsโ
| Color | R | G | B |
|---|---|---|---|
| White | 255 | 255 | 255 |
| Warm white | 255 | 200 | 100 |
| Red | 255 | 0 | 0 |
| Green | 0 | 255 | 0 |
| Blue | 0 | 0 | 255 |
| Purple | 128 | 0 | 255 |