No data from Tasmota via mqtt

I flashed Tasmota to a sonoff. It is publishing temp and humidity data via mqtt:
tele/D1mini01/SENSOR = {“Time”:“2019-03-01T03:17:07”,“DHT11”:{“Temperature”:78.1,“Humidity”:20.0},“TempUnit”:“F”}

I have mosquitto workiing:
1551406139: New client connected from as DVES_0460ED (c1, k10, u’mosquitto’)

Here is from my config.yaml

name: Temperature
platform: mqtt
state_topic: tele/D1mini01/SENSOR
unit_of_measurement: °F
value_template: "{{ value_json.temperature }}"
  • name: Humidity
    platform: mqtt
    state_topic: tele/D1mini01/SENSOR
    unit_of_measurement: “%”
    value_template: “{{ value_json.humidity }}”

When I check these entities (temp,humid), no state is listed in HA and the numerical values do not appear in Lovelace.

I am stumped after many hours. Thanks. Chuck

you looked for sensor.temperature and sensor.humidity in states? Did you type in d1mini01 to see if anything is in there? Did you add the MQTT integration?

value_template: "{{ value_json['DHT11'].Temperature }}"
value_template: "{{ value_json['DHT11'].Humidity }}"

Edit: removed errant ‘.’ from templates.

David, MQTT has been integrated.

The only current entities I have listed are as follows:
group.all_switches (a sonoff switch which works in HA)
sensor.hunidity (no state listed)
sensor.temperature (no state listed)

I realize I misspoke. The device I am trying to get working is a Wemos D1 mini flashed with Tasmota, not a sonoff)

  1. I am not an expert.

  2. I have a DHT11 on a Sonoff Basic/Tasmota.
    I believe your problem is in the template. Here is my sensor yaml lines for this sensor:

    - platform: mqtt
      name: "Room Temperature"
      state_topic: "tele/room/SENSOR"
      value_template: "{{ value_json['DHT11'].Temperature }}"
      force_update: true 
      unit_of_measurement: "°F"   
    - platform: mqtt
      name: "Room Humidity"
      state_topic: "tele/room/SENSOR"
      value_template: "{{ value_json['DHT11'].Humidity }}"
      force_update: true 
      unit_of_measurement: "%"

I don’t speak JSON, but here is how I figure out my templates. (It usually works).
Run the tele data through a JSON formatter:
The formatter cleans up the JSON data and makes some human sense out of it:


From this, you can see that the Temperature and Humidity are properties of DHT11, thus the template for temperature should be:

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

Hope this helps

Tom, Even with my glasses on I can’t see any errant ‘.’ in my template.

No that was a mistake in the templates I provided you. Look at the edit history of my post (orange pen icon top right of my post) you will see I originally had a dot in front of the square brackets.

David, Tom and Steve:
It now works. A half hour in this forum got me going after hours of YouTube, reading, etc.
Many thanks.

1 Like

For future readers of this thread who might be experiencing the same issue- how did you finally fix it?

I just copied and pasted your code into my config.yaml file. I checked it in first which changed the order of the lines. I fixed this, checked the config and restarted. Bingo!

I use for formatting and validating JSON data.

To the best of my novice experience, the order of the lines at the same indent level is usually irrelevant.

I like this better- thanks for the link.

Refer to this post of mine. Its working.