MQTT Sonoff/Tasmota TH10 Temp sensor readings Noob

I’ve set up my first Sonoff TH10 flashed with Tasmota, switch working fine but using the Sonoff DS18B20 temp sensor HA appears to be treating the temp sensor value as a text not a numeric value, it appears on the front page icon as ’ 28.4’ (single quote marks before and after value) and no values are plotted on the history values graph when double clicked.

this is the MQTT from the Tasmota console

MQT: tele/fishtank_temp/SENSOR = {"Time":"2018-02-18T06:56:46","DS18B20":{"Temperature":28.4},"TempUnit":"C"}

see below for my sensor setup, I’ve tried multiple options but not appears to clear the surrounding quote marks.

    name: "Fishtank Temp"
    state_topic: "tele/fishtank_temp/SENSOR"
    value_template: ‘{{ value_json.DS18B20.Temperature }}’
    unit_of_measurement: '°C'
1 Like

have you tried:

value_template: ‘{{ value_json.DS18B20.Temperature | float}}’

I’ve given that a try, no change unfortunately, thanks for your suggestions anyway.

Try this way:

    name: "Fishtank Temp"
    state_topic: "tele/fishtank_temp/SENSOR"
    value_template: '{{ value_json["DS18B20"]["Temperature"] }}'
    unit_of_measurement: "°C"

I use this syntax for my TH10 and it works correctly.

3 Likes

Now working, still learning the HA and json syntax.

Thanks for you help.

You’re welcome :+1:. Please flag the message as a solution for future reference.

It also fixed my issue.
Thanks

Keywords: sonoff, th10, th16, ds18b20