[SOLVED] Sonoff temperature configuration


(Brian Holst) #1

Hi all,
I am having some problems with a Sonoff TH10. I get the relay to switch on and off and I can see the status in OH but I cannot get the temperature to display.
My item :

Number temp "Temperature  [%.1f °C]"  		<temperature>   (GP)   { mqtt="<[broker:%kitchen%/sonoff-AA1/SENSOR:state:JSONPATH($.DS18x20.Temperature)]" }

and my mosquitto :

%kitchen%/sonoff-AA1/SENSOR {"Time":"1970-01-01T01:21:55","DS18x20":{"DS1":{"Type":"DS18B20","Address":"28FF9D31A21603C9","Temperature":19.6}},"TempUnit":"C"}

I am not sure if I need to configure anything else to get this to work.

Best regards
Brian


( ) #2

Hello,
please check out:

First thing I’m seeing that is a bit odd is “%ktichen%”. There shouldn’t be any percent characters in your topic. You probably did a mistake while configuring the Sonoff. The real issue: Your jsonpath selector is wrong. It has to be $.DS18x20.DS1.Temperature

Btw. Next time please remember to put your code into code fences.

Happy Hacking!


(Brian Holst) #3

Hi Thom,
Thank you very much for the reply. I have changed my MQTT topic to sonoff-AA1 and my Full Topic to kitchen/sonoff-AA1 but I still get no temperature reading on my sitemap.
My item code is :

Number temp "Temperature  [%.1f °C]"  		<temperature>   (GP)   { mqtt="<[broker:kitchen/sonoff-AA1/SENSOR:state:JSONPATH($.DS18x20.DS1.Temperature)]" }

ans my mosquito is like this

kitchen/sonoff-AA1/SENSOR {"Time":"1970-01-01T00:27:40","DS18x20":{"DS1":{"Type":"DS18B20","Address":"28FF9D31A21603C9","Temperature":19.9}},"TempUnit":"C"}```

Do I need to configure anything else besides from the item file code and the sitemap file code ? As I said, I can see the switch function and feedback.

Best regards
Brian Holst

(DaveM) #4

Did you end up solving this?


(Brian Holst) #5

Hi Dave,
Yes I did. Thom was right. My configuration was wrong and after I corrected it all worked fine.