I want to add a button to the Lovelace GUI. When clicking on this button I would like to send a MQTT message. So I add the entity button via gui and switch to the editor. NextI tried to make a button like this:
But when I click save, the code is gone! Am I doing something wrong or is some kind of bug in the editor? Is the entity button the right choice since the action is not related to the entity?
My UI is stored in a file (ui-lovelace.yaml) and I use VS Code to edit it (in other words, I’m not using the default UI editor). I tried your example, with only minor changes (the topic and the entity name), saved it (successfully), a large button named Vhod appeared, clicked it, and it published the MQTT payload. So, it works for me.
If you are using the default UI editor then you may be correct that it has a bug. As an experiment, change the payload so that it uses single-quotes to delimit the string:
Also tried to remove double quotes from the payload (just for testing puroposes) and still not working. The button definition is now looking OK, but clicking on the button does nothing. Any suggestions?