New MQTT device - Single action no state integration

I’m making a device that plays some sound, like a doorbell.
I’ve looked at the MQTT integrations but couldn’t find one where it’s just a button without any state.

Is there such a option?

More information about the device you’re making would be helpful. Is it using ESPHome, Arduino, QtPy, or maybe it’s a Raspberry Pi device? There is definitely an option in almost any of those to create a MQTT based sensor that is a button.

You probably want an MQTT event

I’m sorry I wasn’t more clear. I want an actuator, not an input that’s stateless.

For example, a doorbell plays a tune. It doesn’t turn on the tune for a bit and turn it off. Or one of those building door latches you can open from your apartment, you just act on the device, it has no state.

All the mqtt devices I find have a state, like a light that can either be on or off.

For clarity, I’m trying to have a button on HA ui that let’s me play some sound on a remote device. Both connected by mqtt.

For a irrigation pump with a fixed time, I simply used a switch and ON and OFF states, but the microprocessor sets the state back to OFF itself.

HASS → MQTT → Device ON
Device → MQTT → HASS OFF

You’re not really more clear :wink:

On the HA side, you have the mqtt.publish service, that can be triggered, e.g., by an input_button

Hum… Let’s take a light bulb as an example. To turn it on you would send the payload “ON” on the topic “homeassistant/switch/lights/set”. Then the bulb device would send back “ON” on the topic “homeassistant/switch/lights/state”. In the HA UI you would see a toggle that’s grey, you click it, it turns blue in a short while.

What I want is something where I’ll send “TRIGGER” on the topic “homeassistant/switch/lights/set”. There would be no state topic, so the device doesn’t send anything back. And the HA UI would only show a flat button, without any sort of state information.

Yeah, exactly what I said.

Just that the topic will be more “my_device/set”, as the device will be the recipient/subscriber, while HA will be the publisher, so it will not be in the “homeassistant” topic, which is where HA expects stuff when acting as a subscriber.

Ah, but that’s an hadoc integration it doesn’t do the MQTT discovery I would need to create the button myself.

Actually, what you want is an MQTT button

Re auto-discovery, just make up the discovery payload, and have your device publish it.

1 Like

You are right, thanks a lot!