Can I trigger an automation with MQTT command? (SOLVED)

I’m trying to setup an automation that is going to be triggered by MQTT command:

MQT: cmnd/MY_SONOFF/POWER = TOGGLE

Any idea on how can I do it?
I’m using sonoff switch with tasmota firmware flashed.

Not double click, but I’ve set up a long and short press using the rules available on ESPEasy.
For example, in the garage I’ve set up a button which when pressed for less than one second, toggles the garage light, when pressed for more than one second toggles the garage door.

Basically, pressing the button starts a one second timer. After the timer is finished, if the button is no longer pressed, short press, if the button is still pressed, long press.

That might be an option, but I’m quite sure it’s possible to simply use MQTT command (sonoff is sending after double click) and use it as a trigger.
I might create MQTT switch which could be toggled with MQTT command. Then I could simply look for that switch state changes to trigger an automation. This would probably work but it requires to have additional switch just because I don’t know on how to use MQTT command as trigger.

MQTT automation trigger.

Yeah. I have actually done it already, with help of the same link. I was looking at it few days ago and couldn’t figure out on how to use it with scenario. Today everything was obvious.
Anyway, many thanks for the link. This solved my problem :slight_smile:

1 Like