[SOLVED] Openhab2 sonoff th16 AM2301-temperature reading --mqtt

02:02:15 MQT: tele/sonoff/SENSOR = {“Time”:“2018-01-03T02:02:15”,“AM2301”:{“Temperature”:23.8,“Humidity”:59.1},“TempUnit”:“C”}

i cant read the temperature on openhab…can somebody Show a sitemap and item for this…thanks

buy the way the switch Works fine with mqtt…

You will need the JSONPath Transformation add-on installed.

Your .items file will look like this:

Number SonoffTemp "Sonoff Temperature [%.1f °C]" <temperature> {mqtt="<[broker:tele/sonoff/SENSOR:state:JSONPATH($.AM2301.Temperature)]"}

And Sitemap:

Text item=SonoffTemp

Hope this helps you understand a little more.

1 Like

thank u so so much…it work exilent

Hey Gary, i have been messing with this for days. This is where I am. I have the same thing as Ceyhun. My switch works just fine with the th16. I show the temp and humidity in the tasmato console.

This is some of what I cobbled together from threads including your line:

String Indoor_State "[%s]" (startpersist) {mqtt="<[broker:stat/sonoff-00th161/POWER:state:default]"} 
Number Indoor_Temperature "Indoor Temperature [%.1f °F]" <temperature> {mqtt="<[broker:tele/sonoff-00th161/SENSOR:state:JSONPATH($.AM2301.Temperature)]"}
Number Indoor_Humidity "Humidity [%d %%]" <humidity>  {mqtt="<[broker:tele/sonoff-00th161/AM2301/HUMIDITY:state:default]"} 

site map:

 Text item=Indoor_Temperature
 Text item=Indoor_Humidity

still dont get either to show up.

thanks!

just as i say that it shows up. lol. but its not 20 degrees F in my basement. i guess its showing as C. how do you change that? thought i did it with the command in there.

grrr, now I added this and I dont get either of the readings:

String Indoor_State "[%s]" (startpersist) {mqtt="<[broker:stat/sonoff-00th161/POWER:state:default]"} 
Number Indoor_Temperature "Indoor Temperature [%.1f °F]" <temperature> {mqtt="<[broker:tele/sonoff-00th161/SENSOR:state:JSONPATH($.AM2301.Temperature)]"}
Number Indoor_Humidity "Humidity [%d %%]" <humidity>  {mqtt="<[broker:tele/sonoff-00th161/SENSOR:state:JSONPATH($.AM2301.Humidity)]"} 

Every now and then the results show up but then disappear.