Skip to main content

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โ€‹

PinESP32 GPIONotes
R (Red)GPIO 16Via MOSFET or resistor
G (Green)GPIO 17Via MOSFET or resistor
B (Blue)GPIO 18Via MOSFET or resistor
GNDGNDCommon with ESP32

Add an RGB device (dashboard)โ€‹

  1. Open Devices โ†’ Add device
  2. Choose type: RGB Light
  3. Set GPIO pins for R, G, and B
  4. Set the ESP32 board name (e.g. sala)
  5. Save

The device id in the platform must match id in the ESP32 devices_config JSON.

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โ€‹

ColorRGB
White255255255
Warm white255200100
Red25500
Green02550
Blue00255
Purple1280255