YAML-configured button for dash that publishes 2 MQTT messages

I want to create a button that send 2 messages for 1 device. I know I can use Node-Red or automations. But I want to keep things as simple as possible so I was wondering if I can publish 2 MQTT messages with 1 button in the front end configured by YAML. I have looked around but found nothing.

I am not sure, if you can run/trigger an Action from a Template.

Then create an automation and add it to your dashboard. :slight_smile:
Or create a Script and add this to your dashboard.

This is a simple script, which closes our blinds to 66%.

There is an Automation, which triggers the script if certain conditions are true.

Sometimes, I would like to close the blinds manually, so I added the Automation and the scripts to my Dashboard. Simple and easy. :wink:

Thanks! For 1 MQTT message it’s even simpler than an automation, you can just add a button with some config. No automation needed MQTT button - Home Assistant

I was hoping it’s possible to add 2 MQTT messages there. Otherwise I will probably be using Node-Red for it.

It sounds as if what you want can be done by a “Template Button” helper entity which can be configured in the GUI, no YAML required.

ETA: the template integration docs imply this can be done in YAML if you really want to, but provides no examples which has led to some confusion on required syntax.

1 Like

Thanks! I’ll give that a go.

Seems to do what I want it to, now to put this on a card as a custom button :slight_smile: