Read payload from Tasmota switch [SOLVED]

Good evening everyone
I can’t get OH2 to read the ON / OFF status change from the topic:
stat / boiler_room / MQ2
I use the broker mosquitto 1.1
The payload comes from a NODEMCU peripheral, configured with TASMOTA11, and the MQ "sensor that sends the payload is connected to the GPIO12 as Switch1.
With MQTTlens I read the payload (ON OFF) , so the message is sent correctly, but OH does not change the state of the switch. Some help … thanks

Switch sensore_caldaia        "sensore caldaia "                        <sensore_fumo>	 (sensori)    		    {mqtt="<[mosquitto:stat/locale_caldaia/MQ2/power:state:default]"  }


 Switch item=sensore_caldaia```

Please confirm the MQTT Binding version that you have installed. Your syntax is for v1 of the binding…

Mosquitto rel 1.4.15

That’s your MQTT broker version. What’s the version of the MQTT Binding in openHAB?

ah…ok :grinning:
MQTT binding 1.13.0

no help?

Not many people left still familiar with binding version1.x

Does your broker config work i.e. have you other mqtt Items that work?

Always worth making a temporary String type Item, with the same binding link, in case the payload is not what you expected (we have not seen your mqtt messages yet).

I have other Tasmota peripherals that work perfectly with my broker. In this case with MQTTlens I see that the payload corresponds to ON and OFF. What I can’t do is configure the right topic to read from OH the payload of switch1 connected to GPIO12 in tasmota, to activate a switch type item

Reading This old thread might help.

How about sharing that. It’s really difficult to help you.

tasmota consolle:

16:10:25.811 RUL: SWITCH1#STATE=0 performs "publish stat/locale_caldaia/MQ2 ON"
16:10:25.817 MQT: stat/locale_caldaia/MQ2 = ON
16:10:27.147 RUL: SWITCH1#STATE=1 performs "Publish stat/locale_caldaia/MQ2 OFF"
16:10:27.153 MQT: stat/locale_caldaia/MQ2 = OFF


These topics are not the same

yes I see it, the first is the OH item files
to control a peripheral with TASMOTA the topic must indicate what to control … for example POWER controls the main relay, LWT the network status etc.
The second line is what I read from the terminal of the peripheral which corresponds to the payload which also reads MQTT.fx.
In my case I connected an MQ2 sensor to the GPIO12 and I cannot get the ON / OFF status to be read by OH because I don’t know which is the right topic

 Switch sensore_caldaia             "sensore caldaia "                        <sensore_fumo>	    (sensori)    		    {mqtt="<[mosquitto:stat/locale_caldaia/MQ2/???????:state:MAP(]"  }

i try SWITCH SWITCH1 POWER1 STATE …but not read from OH

basically I need OH to read the feedback from the switch

Soooooo - what happens when you correct your openHAB Item to use the exact topic highlighted by @rossko57 (the one I’ve quoted)?


Confirm that such a definition does not work:

Switch sensore_caldaia        "sensore caldaia " { mqtt=">[mosquitto:cmnd/local_caldaia/MQ2:command:*:default],
            <[broker:stat/local_caldaia/MQ2:state:default]" }

Made this up from the old thread I linked above and the MQTT message as printed from your tasmota console.

this work!!! thanks guys, I was going crazy for such a trivial thing!!!

   Switch sensore_caldaia                 "sensore caldaia "                                                             {mqtt=">[mosquitto:cmnd/locale_caldaia/MQ2:command:*:default], <[mosquitto:stat/locale_caldaia/MQ2:state:default]" }

Such as reading the answers you got?

1 Like