Using WLED Button as Trigger in Home Automation

Hey!

New here and new to the world of WLED (and Home Automation). I have an ESP32 with WLED installed which I have successfully linked it with HA using the native integration.

I have some physical buttons wired up to some of the ESP GPIO pins, and I have set these up as Buttons in the WLED settings. What I want to do to trigger some HA automations using these buttons, however in HA I cannot find a relevant sounding Trigger listed in the Device Trigger settings (the closest sounding one is “WLED Restart has been pressed”).

My use case is that I have a box which has a button, some lighting and some other outputs (2x 12v fans and some speakers). When the button is pressed, the lights are going to change for a few seconds before returning to their default ambient mode and the fans and speaker are going to start. So, I would like the button on the box to act as a Trigger in HA to start all the other outputs going (I know the button can directly trigger the light change without going through HA) without the need for another ESP with ESPHome to send the button press to HA.

Hope that makes sense… is this possible?

Thank you!

Enable button press in MQTT settings.

I believe I’m not using MQTT, but the native integration. Sorry if I misunderstand you.

I did try to get MQTT working by adding the integration and message broker, however I couldn’t get any device to show in HA and I concluded this was because WLED doesn’t support discovery which is a requirement for HA. Again, apologies if I’ve misunderstood.

Cheers

button discovery over MQTT is not implemented (and unless someone volunteers it will not be), however button actions are broadcast using MQTT

Ah okay, this sounds good. Thanks.

Is there any documentation or tutorial around this? I don’t understand where to see the button actions in HA, as when I set up MQTT I don’t see really any difference in HA

Spent a couple of hours trying to get this working last night however I still haven’t progressed.

I have my Sync Setup page setup as follows:

Enable Sync on start: Yes
Send notifications on direct change: Yes
Send notifications on button press or IR: Yes

MQTT
Enable MQTT: Yes
Broker: homeassistant.local
Port: 1883
Username: [My Home Assistant username]
Password: [My Home Assistant username]
Publish on button press: Yes

Client ID: WLED-a16fd4
Device Topic: wled/a16fd4
Group Topic: wled/all

I have saved those settings and restarted the ESP.

I have also downloaded MQTTX to try to see messages. I can successfully login the broker using MQTTX which indicates the auth is working, however I can’t see anything on the topic wled/a16fd4 or wled/all, or wled/#.

Can you help me get this setup?

Cheers

My problem was the Broker host “homeassistant.local” wasn’t working for some reason. Using a hardcoded IP fixed everything