Skip to content
Aircoookie edited this page Oct 2, 2018 · 23 revisions

WLED versions from 0.8.0 up are able to connect to an MQTT broker for smart home control. Connection to both domains and IP servers is supported on port 1883.

WLED will subscribe to up to six topics to change the state of the lights.

  • [mqttTopic0]
    -> Send brightness as ASCII number 0-255 or the strings "ON", "OFF", and "T" (for toggle)

  • [mqttTopic0]/col
    -> Send color as HEX (#WWRRGGBB or #RRGGBB) or 32bit DEC. Hex has '#','h' or 'H' as prefix.

  • [mqttTopic0]/api
    -> Send a call to the API. You may omit the "win" and just send e.g. "FX=73"

  • [mqttTopic1]

  • [mqttTopic1]/col

  • [mqttTopic1]/api

The topic parts [mqttTopic0] and [mqttTopic1] are customizable in Sync settings.
If [mqttTopic1] is left empty, it will not subscribe to anything. An empty [mqttTopic0] will instead be replaced with the default "wled/macaddr".
[mqttTopic0] is intended to be unique to one WLED device and just control that device.
[mqttTopic1] is intended to control a group of or all WLED devices.
Both topics don't send UDP notifications by default, but can be set to do so (e.g. if only one WLED device is connected to the broker and the rest are to be synced via UDP)

Additionally, on light change, WLED will publish to three topics for MQTT clients to know the state of the light.

  • [mqttTopic0]/g
    -> Contains current brightness as ASCII number 0-255

  • [mqttTopic0]/c
    -> Contains current color as HEX (#RRGGBB if white is 0, else #WWRRGGBB)

  • [mqttTopic0]/v
    -> XML response that is sent after an http API call (contains values such as color and FX)

The connection to the MQTT server might cause lag in some circumstances. The boot time of the ESP may also be longer.

Clone this wiki locally