MQTT Buttons with matching topic/varying payload?

Hi Again Guys,
I Just installed tasmota on an esp32, and I have a few Button_tc modules setup (A touch button)
when I press (touch) one of the buttons it sends to this mqtt topic: stat/tasmota_4A4E84/RESULT and with this payload: {“Button1”:{“Action”:“SINGLE”}} or maybe this payload: {“Button2”:{“Action”:“SINGLE”}}

Since The Payload contains which button is pressed as well as the item value “SINGLE” I’m not sure how to handle this on the openhab side any thoughts or suggestions would very much welcome.

I would make a Thing Channel per button, and then in the incoming transformation use REGEX first to filter for the correct button, then JSONPATH to extract the action value.

With tasmota you can change the way it sends commands to MQTT

In the tasmota console type

SetOption4 1

This may break up the response to MQTT to help with openHAB integration

You could also use 1 topic for all results and use a rule to update all of your items.

thank you this works a treat.

1 Like