Tasmota as a MQTT button remote

Hi all,

I’m trying to build a MQTT-publishing array of buttons using an ESP8266 NodeMCU running Tasmota. I have four physical buttons wired, and configured as Switches, and they all publish a MQTT “stat/”. However, I can’t figure out how to make them publish a command that identifies which button was pressed. Not sure if rules will help. Anyone done anything like this?

What do they each publish?

They all publish the same commands:

13:27:26 MQT: cmnd/tasmota/test/POWER = ON
13:27:26 MQT: stat/tasmota/test/RESULT = {"Command":"Unknown"}
13:27:35 MQT: cmnd/tasmota/test/POWER = ON
13:27:35 MQT: stat/tasmota/test/RESULT = {"Command":"Unknown"}
13:27:44 MQT: cmnd/tasmota/test/POWER = ON
13:27:44 MQT: stat/tasmota/test/RESULT = {"Command":"Unknown"}
13:27:45 MQT: cmnd/tasmota/test/POWER = ON
13:27:45 MQT: stat/tasmota/test/RESULT = {"Command":"Unknown"}
13:27:47 MQT: cmnd/tasmota/test/POWER = ON
13:27:47 MQT: stat/tasmota/test/RESULT = {"Command":"Unknown"}

I think the way to do it is connect switches to non-existent relays but that seems so ungraceful. I’ll give it a shot later today.

You need to read in depth the tasmota command wiki.
It should be possible to get each switch to send a different message

13:27:26 MQT: cmnd/tasmota/test/POWER = ON
13:27:26 MQT: stat/tasmota/test/RESULT = {"Command":"Unknown"}

This means that you ESP doesn’t recognise the POWER ON command
Each switch should be accessible under a different command, for example:

cmnd/tasmota/test/POWER1 ON
cmnd/tasmota/test/POWER2 ON
cmnd/tasmota/test/POWER3 ON

But that will depend on your tasmotta setup

you must also pass virtual relay
Switch1 --Relay1 = cmnd/tasmota/test/POWER1 =
Switch2 --Relay2 = cmnd/tasmota/test/POWER2
Switch3 --Relay3 = cmnd/tasmota/test/POWER3 …

Thanks guys. Seems like having the virtual relay is the only way to do it. Seems a little kludgy, but, hey… isn’t much of this stuff?