Getting temp from a Tasmotized Sonoff th16 to Home Assistant

Flashed the Sonoff TH16 with Tasmota. Can access it directly and get the temp measurement, as well as turning it on/off. The sonoff is coupled with a DS18B20 temp sensor.

Configured a sensor in Config.yaml file. I can get the entity shown but with an “unknown” temp.

The mqtt toipc I configured in the sonoff menu is : sonoff_th16.

Here is my sensor config in the yaml:
`
sensor:

  • platform: mqtt
    name: “Sonoff TH16”
    unique_id: “sonoff_th16”
    state_topic: “tele/sonoff_th16/SENSOR”
    value_template: “{{ value_json[‘sonoff_th16’].Temperature | float }}”
    qos: 1
    unit_of_measurement : “°C”
    device_class: temperature
    state_class: measurement
    `

What am I doing wrong or missing here?

I believe you need

  value_template: "{{ value_json['DS18B20'].Temperature }}"

That really fixed it. Thanks a lot.

How can I increase the temp update frequency on the dashboard? I noticed that there is a lag between the temp updated on the tasmota gui and the temp on the device?

Thanks again

1 Like

The data appears on the dashboard when the tasmota’ed device sends it via MQTT. By default this is every 300 secs, but this can be changed on the device using the teleperiod command

Thanks. Problem solved. But “with food comes appetite”…
Trying to get the voltage and power from Sonoff POW.

Defined another sensor for that, but don’t get the details to the HA dashboard.

The mqtt topic on the Sonoff is “coffee_machine”.

here is my setup:

sensor:
  - platform: mqtt
    name: "POW Voltage"
    unique_id: "coffee_machine"
    state_topic: "tele/coffee_machine/SENSOR"
    value_template: "{{ value_json.StatusSNS.ENERGY.Voltage }}"
    qos: 1
    unit_of_measurement: 'volts'

https://tasmota.github.io/docs/Home-Assistant/#power-monitoring

Thanks. Will give it a try