Button to control relay And update UI

hi, Im using two power supplies . one for esp32 and other power supply to the leds. i have connected relay in such a way that , when triggered relay can turn ON and OFF the power supply(which controls the leds).
My question is, I want to add a momentary button in esp32 to control the relay (to turn on and off the power supply) and also update it in UI.
this could be really helpful that. I dont have to open UI every time to turn on or off the relay, rather the push button can turn on and off the relay manually and also it would be great if it updates the status in UI too.

My schematic looks something like this below:


In the LED Preferences, you should see Hardware setup. Under there, you should see options to set the pin for your momentary button and another to choose a relay pin. This should allow you get the setup you are looking for. After you set the pins, you can go to Settings → Time & macros where you should see Button actions. Where you can choose what happens for the various button presses (short, long, double). You can set each action to a preset number. To toggle the power via the relay, you should create a preset with &T=2 and set that preset number to the desired button action. That should toggle the power on/off.