Long press button (tasmota switch) send MQTT command?

I’m trying to setup a tasmota wall plate to send an MQTT command on long press and I was hoping someone else knew exactly how to do it?

I actually managed to get this to work some time ago through trial and error and reading the Tasmota documentation but it took me a good couple of hours and I can’t remember what I did.

I would like to maintain the switch function on short press, and send MQTT command on long press for one switch. But replace both long and short press with MQTT commands with a second switch.

The switch I’m using is this one: https://templates.blakadder.com/deta_6911HA.html

Hi,

First, make sure “SetOption1 0” is enabled on your switch. Most people disable this as it makes the switch faster to react rather than waiting to see if you are long pressing or not.

Hopefully if you have auto discovery it should just pick it up, if you are manually doing it you would setup another switch (copy existing MQTT) and change it to long.

Whilst you are in the console checking on setoption1 you can long push the button and see the mqtt message it sends.

Simon

1 Like

If you decouple the buttons from the relays,
SetOption73 1

You can then send the mqtt messages to HA without doing anything. If you want to retain the short press, then create a rule,
Rule1
ON BUTTON1#State=10 DO power1 Toggle ENDON
Rule1 1

Now switch will do single press local, but everything else is done by HA.

1 Like

You legend. That’s exactly what I needed. Took 5 minutes to setup and works perfectly.