Receiving from MQTT

I have some troubles getting values from MQTT.

I already have a working setup where is can turn a Sonoff device ON and OFF, but when just wanting to fetch information, i get nothing.

I am trying to recieve IP address.

In items i have:

Number Sonoff1_IP {mqtt="<[oh2:stat/sonoff1/IPAddress1:state:default]"}

In sitemap i have:

Text item=Sonoff1_IP

If i test with: mosquitto_pub -h 127.0.0.1 -p 1884 -t cmnd/sonoff1/IPAddress1 -m ""
I get the following in Mosquitto_sub:

stat/sonoff1/RESULT {"IPAddress1":"192.168.0.161 (192.168.0.161)"}

But in OpenHAB console, i get nothing!

I am sure this is simple, could somebody please provide me with the knowledge?

Thanks.

Hello @Joker Did you check other threads and tutorials?

Please pay attention to:

Especially:

  • “Avoid being spoon-fed”
  • “How to use code fences”

These threads might be useful for you


I’ve just cleaned up your post and now it’s clear. Your item definition is completely wrong. You are trying to retrieve data from a command topic which in tasmota is a publish-only topic (“cmnd”) You need to select the correct topic and then use the jsonpath transformation to select “IPAddress” resp. “IPAddress1”. You can learn how to do so in the last link above.

I will not post the answer here because many have tried to make sure that all information is available and easy to understand behind those links above.

3 Likes