Unable to configure MQTT Button

Hello,
I’m trying to configure an MQTT button to send a value to a topic on a custom device.
I’m using HA core-2021.12.10 so it should have the ability to be used.

This is my section of the configuration.yaml file:

#MQTT BROKER
button:
  - platform: mqtt
    unique_id: via_vela_gate
    name: "Cancello Via Vela"
    command_topic: "/viavela/antsthings/cancello/command"
    payload_press: "1"
    qos: 0
    retain: false

As soon as I press the button in HA I got the popup ’Failed to call service button/turn_off. Service not found.' and nothing happens. Do I have done something wrong?

Thank you!!!
//Antonio

What MQTT broker do you have installed? The broker can be installed via the Add-on store (search for ‘mosquitto broker’ or manually via config: MQTT - Home Assistant (home-assistant.io)

After installation of the broker, you can subscribe to a topic.

The service for a button is button.press, not “turn_off”.

1 Like

Hi, I’ve a mosquitto broker that resides in a VPS. It already works with IFTTT, so the issue is not on the broker but I’m missing something in the HA core configuration.

Thank you!
Found it! I had inserted in my panel the button and the default has ‘Tap Action’ configured as toggle: So, I’ve changed the default behaviour to ‘Call Service’


and now it’s working fine!
So, seems that the button card is missing the button Press call even if you can select a button entity… maybe it will be implemented in a future HA version.