In this tutorial I want to show you how you can use switches to send messages like “On” or “Off” , “High” and “Low”, 0 and 1 etc.
In this tutorial I will send messages with switch and use other two button, with a pre-defined “ON” and “OFF” messages to control the switch.
https://rundebugrepeat.com/webmqtt/
After connecting to a client, click on the “Add new UI element” button.

Select the switch tab and set the switch, for example:
- path: rundebugrepeat/test/led1
- to turn on the switch: “ON” message
- to turn off the switch “OFF” message
The switch will looks like this in the dashboard.
WEB MQTT – Switch WEB MQTT – Switch (turned on)
When you turn on the switch the “ON” pre-defined message will be sent, when you turn it off the “OFF” message will be sent.
If you add two buttons with the same path, one with the “ON” message and the other with the “OFF” message you can controll the switch with the two button.
