Configuring WLED with MQTT

Hello,

I’m having some trouble with configuring my WLED in home assistant. What I am trying to do is adding WLED to my home assistant environment. The tricky part is that i am trying to do this using MQTT with detection disabled. I have set my home assistant IP as my MQTT broker

Here is my config.yaml:

light:
  - platform: mqtt
    name: “wled1”
    state_topic: “wled/light/status”
    command_topic: “wled/light/switch”
    brightness_state_topic: ‘wled/light/brightness/status’
    brightness_command_topic: ‘wled/light/brightness/set’
    brightness_scale: 100
    rgb_state_topic: ‘wled/light/rgb/status’
    rgb_command_topic: ‘wled/light/rgb/set’
    qos: 0
    payload_on: “ON”
    payload_off: “OFF”
    optimistic: false

And here is a screenshot of my WLED settings:

The weird thing is that Home Assistant detects the entity in Lovelace and I can even add it, but when I click the “on” button nothing seems to happen. Sometimes the on switch works but my LED device won’t react to it (and neither does WLED).

Any help is greatly appreciated.

Guys, i’ve found the answer. I was using a VM for my HomeAssistant environment and had to make sure the connection of the virtual machine was set to bridged. If you do this, your HomeAssistant can communicate with WLED.

I hope this helps someone someday.

3 Likes

Hi all,
since there are problems with the native integration WLED led strip or RGBCCT bulbs,
I would like to try to integrate the WLED devices with MQTT, can someone post a sample yaml configuration, I can’t get it to work

Thanks

What kind of problems are you referring to? Just analog stuff? Assuming you are pointing your WLED at your HA mqtt and have login credentials working (mqtt logs will show if it’s connecting to your WLED instance or not), the example above is old and wrong in both screenshots (the mqtt port should be 1883 vs it’s wrong with 8123 in the pic although you do want the IP of your HA just with 1883 port).

Also a year or two ago mqtt entities changed how they integrate with yaml hence why the above config is now incorrect but was fine at the time in 2020. It also seems since mqtt autodiscovery is disabled you wont even find the device under mqtt integration as mine only shows under all HA entities (in my case light.cabinets) yet it says MQTT under integration it belongs too - confusing i know. I just figured this out this AM because I need to get the door sensor from WLED into my HA to have better time-based lighting control (less light when dark - hate being blinded by 100% white in the dark hahah). Got the light working via this config - now to try the switch/door contact.
add this to your config.yaml - key point under mqtt>light! not under Light> platform

mqtt:
  light:
    - name: "Cabinets"
      command_topic: "wled/cabinets"
      brightness_command_topic: "wled/cabinets"
      rgb_command_topic: "wled/cabinets/col"
      rgb_command_template: "{{ '#%02x%02x%02x' | format(red, green, blue)}}"
      effect_command_topic: "wled/cabinets/api"
      effect_list:
        - "FX=0"
        - "FX=1"
        - "FX=2"
        - "FX=3"
        - "FX=4"
        - "FX=5"
        - "FX=6"
        - "FX=7"
        - "FX=8"
        - "FX=9"
        - "FX=10"
        - "FX=11"
        - "FX=12"
        - "FX=13"
        - "FX=14"
        - "FX=15"
        - "FX=16"
        - "FX=17"
        - "FX=18"
        - "FX=19"
        - "FX=20"
        - "FX=21"
        - "FX=22"
        - "FX=23"
        - "FX=24"
        - "FX=25"
        - "FX=26"
        - "FX=27"
        - "FX=28"
        - "FX=29"
        - "FX=30"
        - "FX=31"
        - "FX=32"
        - "FX=33"
        - "FX=34"
        - "FX=35"
        - "FX=36"
        - "FX=37"
        - "FX=38"
        - "FX=39"
        - "FX=40"```

Let’s keep this thread alive haha. Let me know if you need a hand - I am no expert but seem to have it working! The MQTT docs on WLED seem to need an update!

Hi,
thanks for the answer :slight_smile:
I would like to integrate WLED with Mqtt and not natively for this reason: Re-evaluate CCT with WLED and the HA WLED integration

As soon as I can I’ll try your configuration and update you