DHT22 attached to Sonoff (Tasmota 9.2.0) - MQTT - no values available

Hi,

I have a configuration issue I guess, but I’ve looked around this topic and didn’t find a solution by myself.

So my problem is, I didn’t retrieve any values vor my sensor configuration. I’ve flashed a Sonoff Basic device with Tasmota (9.2.0) and configured MQTT as basis for communicating sensor values.
So far so good, the attached DHT22 is working (selected AM2301 in Tasmota) and Values are shown on web interface of the Sonoff device.

To be sure that MQTT broker is working too, I’ve installed an app on my macbook called MQTTfx to subscribe to the MQTT topic and also to connect to the Mosquito MQTT broker. There I’m receiving a JSON Structure such as this:

{
  "Time" : "2021-02-06T14:00:58",
  "AM2301" : {
    "Temperature" : 22.8,
    "Humidity" : 42.4,
    "DewPoint" : 9.3
  },
  "TempUnit" : "C"
}

My configuration.yml looks like this:

sensor:
  - platform: mqtt
    name: "DHT22 Keller"
    state_topic: temperature/tasmota_A0980C/SENSOR
    value_template: '{{ value_json["AM2301"]["Temperature"] }}'
    unit_of_measurement: '°C'
    device_class: temperature

I’ve also tried do switch between " and ’ and also tried to change the value_json syntax as I found several examples online, but nothing helped. The sensor just looks like here:
dht22-no-data

So, am I missing something?
Can someone find the mistake or missing detail?

Please try this in as sensor config

sensor:
  - platform: mqtt
    name: "DHT22 Keller"
    state_topic: "temperature/tasmota_A0980C/SENSOR"
    unit_of_measurement: "°C"
    value_template: "{{ value_json.AM2301.Temperature | float - 0 }}"
    device_class: temperature

Thanks sheminasalam for your suggestion.

That “| float - 0” probably converts to floating point values I guess.
However, I don’t retrieve anything, at least my sensor value still says unavailable :frowning:

I set TelePeriod to 15, just to receive more MQTT messages from the sensor and I’m getting messages in MQTTfx app, so the problem should be somewhere in the configuration, but I don’t know where to look at next.

please share the logs from the tasmota console.

Alright, this is about the last hour on console:

17:34:38 MQT: temperature/tasmota_A0980C/SENSOR = {"Time":"2021-02-07T17:34:38","AM2301":{"Temperature":22.6,"Humidity":39.4,"DewPoint":8.1},"TempUnit":"C"}
17:39:33 MQT: temperature/tasmota_A0980C/HASS_STATE = {"Version":"9.2.0(tasmota)","BuildDateTime":"2020.12.21 15:09:06","Module or Template":"Generic","RestartReason":"Software/System restart","Uptime":"10T19:12:25","Hostname":"tasmota_A0980C-6156","IPAddress":"192.168.0.101","RSSI":"62","Signal (dBm)":"-69","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:03","MqttCount":1,"LoadAvg":19}
17:39:38 MQT: temperature/tasmota_A0980C/STATE = {"Time":"2021-02-07T17:39:38","Uptime":"10T19:12:30","UptimeSec":933150,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"WLAN-Bro-Botka2G","BSSId":"F0:9F:C2:A7:7D:9F","Channel":11,"RSSI":62,"Signal":-69,"LinkCount":1,"Downtime":"0T00:00:03"}}
17:39:38 MQT: temperature/tasmota_A0980C/SENSOR = {"Time":"2021-02-07T17:39:38","AM2301":{"Temperature":22.6,"Humidity":39.4,"DewPoint":8.1},"TempUnit":"C"}
17:44:33 MQT: temperature/tasmota_A0980C/HASS_STATE = {"Version":"9.2.0(tasmota)","BuildDateTime":"2020.12.21 15:09:06","Module or Template":"Generic","RestartReason":"Software/System restart","Uptime":"10T19:17:25","Hostname":"tasmota_A0980C-6156","IPAddress":"192.168.0.101","RSSI":"62","Signal (dBm)":"-69","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:03","MqttCount":1,"LoadAvg":19}
17:44:38 MQT: temperature/tasmota_A0980C/STATE = {"Time":"2021-02-07T17:44:38","Uptime":"10T19:17:30","UptimeSec":933450,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"WLAN-Bro-Botka2G","BSSId":"F0:9F:C2:A7:7D:9F","Channel":11,"RSSI":62,"Signal":-69,"LinkCount":1,"Downtime":"0T00:00:03"}}
17:44:38 MQT: temperature/tasmota_A0980C/SENSOR = {"Time":"2021-02-07T17:44:38","AM2301":{"Temperature":22.6,"Humidity":39.4,"DewPoint":8.1},"TempUnit":"C"}
17:49:33 MQT: temperature/tasmota_A0980C/HASS_STATE = {"Version":"9.2.0(tasmota)","BuildDateTime":"2020.12.21 15:09:06","Module or Template":"Generic","RestartReason":"Software/System restart","Uptime":"10T19:22:25","Hostname":"tasmota_A0980C-6156","IPAddress":"192.168.0.101","RSSI":"62","Signal (dBm)":"-69","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:03","MqttCount":1,"LoadAvg":19}
17:49:38 MQT: temperature/tasmota_A0980C/STATE = {"Time":"2021-02-07T17:49:38","Uptime":"10T19:22:30","UptimeSec":933750,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"WLAN-Bro-Botka2G","BSSId":"F0:9F:C2:A7:7D:9F","Channel":11,"RSSI":62,"Signal":-69,"LinkCount":1,"Downtime":"0T00:00:03"}}
17:49:38 MQT: temperature/tasmota_A0980C/SENSOR = {"Time":"2021-02-07T17:49:38","AM2301":{"Temperature":22.6,"Humidity":39.4,"DewPoint":8.1},"TempUnit":"C"}
17:54:33 MQT: temperature/tasmota_A0980C/HASS_STATE = {"Version":"9.2.0(tasmota)","BuildDateTime":"2020.12.21 15:09:06","Module or Template":"Generic","RestartReason":"Software/System restart","Uptime":"10T19:27:25","Hostname":"tasmota_A0980C-6156","IPAddress":"192.168.0.101","RSSI":"62","Signal (dBm)":"-69","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:03","MqttCount":1,"LoadAvg":19}
17:54:38 MQT: temperature/tasmota_A0980C/STATE = {"Time":"2021-02-07T17:54:38","Uptime":"10T19:27:30","UptimeSec":934050,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"WLAN-Bro-Botka2G","BSSId":"F0:9F:C2:A7:7D:9F","Channel":11,"RSSI":62,"Signal":-69,"LinkCount":1,"Downtime":"0T00:00:03"}}
17:54:38 MQT: temperature/tasmota_A0980C/SENSOR = {"Time":"2021-02-07T17:54:38","AM2301":{"Temperature":22.6,"Humidity":39.2,"DewPoint":8.0},"TempUnit":"C"}
17:59:33 MQT: temperature/tasmota_A0980C/HASS_STATE = {"Version":"9.2.0(tasmota)","BuildDateTime":"2020.12.21 15:09:06","Module or Template":"Generic","RestartReason":"Software/System restart","Uptime":"10T19:32:25","Hostname":"tasmota_A0980C-6156","IPAddress":"192.168.0.101","RSSI":"62","Signal (dBm)":"-69","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:03","MqttCount":1,"LoadAvg":19}
17:59:38 MQT: temperature/tasmota_A0980C/STATE = {"Time":"2021-02-07T17:59:38","Uptime":"10T19:32:30","UptimeSec":934350,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"WLAN-Bro-Botka2G","BSSId":"F0:9F:C2:A7:7D:9F","Channel":11,"RSSI":62,"Signal":-69,"LinkCount":1,"Downtime":"0T00:00:03"}}
17:59:38 MQT: temperature/tasmota_A0980C/SENSOR = {"Time":"2021-02-07T17:59:38","AM2301":{"Temperature":22.7,"Humidity":39.4,"DewPoint":8.2},"TempUnit":"C"}
18:04:33 MQT: temperature/tasmota_A0980C/HASS_STATE = {"Version":"9.2.0(tasmota)","BuildDateTime":"2020.12.21 15:09:06","Module or Template":"Generic","RestartReason":"Software/System restart","Uptime":"10T19:37:25","Hostname":"tasmota_A0980C-6156","IPAddress":"192.168.0.101","RSSI":"62","Signal (dBm)":"-69","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:03","MqttCount":1,"LoadAvg":19}
18:04:38 MQT: temperature/tasmota_A0980C/STATE = {"Time":"2021-02-07T18:04:38","Uptime":"10T19:37:30","UptimeSec":934650,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"WLAN-Bro-Botka2G","BSSId":"F0:9F:C2:A7:7D:9F","Channel":11,"RSSI":62,"Signal":-69,"LinkCount":1,"Downtime":"0T00:00:03"}}
18:04:38 MQT: temperature/tasmota_A0980C/SENSOR = {"Time":"2021-02-07T18:04:38","AM2301":{"Temperature":22.7,"Humidity":38.7,"DewPoint":7.9},"TempUnit":"C"}
18:09:33 MQT: temperature/tasmota_A0980C/HASS_STATE = {"Version":"9.2.0(tasmota)","BuildDateTime":"2020.12.21 15:09:06","Module or Template":"Generic","RestartReason":"Software/System restart","Uptime":"10T19:42:25","Hostname":"tasmota_A0980C-6156","IPAddress":"192.168.0.101","RSSI":"62","Signal (dBm)":"-69","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:03","MqttCount":1,"LoadAvg":19}
18:09:38 MQT: temperature/tasmota_A0980C/STATE = {"Time":"2021-02-07T18:09:38","Uptime":"10T19:42:30","UptimeSec":934950,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"WLAN-Bro-Botka2G","BSSId":"F0:9F:C2:A7:7D:9F","Channel":11,"RSSI":62,"Signal":-69,"LinkCount":1,"Downtime":"0T00:00:03"}}
18:09:38 MQT: temperature/tasmota_A0980C/SENSOR = {"Time":"2021-02-07T18:09:38","AM2301":{"Temperature":22.7,"Humidity":39.0,"DewPoint":8.0},"TempUnit":"C"}
18:14:33 MQT: temperature/tasmota_A0980C/HASS_STATE = {"Version":"9.2.0(tasmota)","BuildDateTime":"2020.12.21 15:09:06","Module or Template":"Generic","RestartReason":"Software/System restart","Uptime":"10T19:47:25","Hostname":"tasmota_A0980C-6156","IPAddress":"192.168.0.101","RSSI":"62","Signal (dBm)":"-69","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:03","MqttCount":1,"LoadAvg":19}
18:14:38 MQT: temperature/tasmota_A0980C/STATE = {"Time":"2021-02-07T18:14:38","Uptime":"10T19:47:30","UptimeSec":935250,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"WLAN-Bro-Botka2G","BSSId":"F0:9F:C2:A7:7D:9F","Channel":11,"RSSI":62,"Signal":-69,"LinkCount":1,"Downtime":"0T00:00:03"}}
18:14:38 MQT: temperature/tasmota_A0980C/SENSOR = {"Time":"2021-02-07T18:14:38","AM2301":{"Temperature":22.7,"Humidity":39.5,"DewPoint":8.2},"TempUnit":"C"}
18:19:33 MQT: temperature/tasmota_A0980C/HASS_STATE = {"Version":"9.2.0(tasmota)","BuildDateTime":"2020.12.21 15:09:06","Module or Template":"Generic","RestartReason":"Software/System restart","Uptime":"10T19:52:25","Hostname":"tasmota_A0980C-6156","IPAddress":"192.168.0.101","RSSI":"62","Signal (dBm)":"-69","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:03","MqttCount":1,"LoadAvg":19}
18:19:38 MQT: temperature/tasmota_A0980C/STATE = {"Time":"2021-02-07T18:19:38","Uptime":"10T19:52:30","UptimeSec":935550,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"WLAN-Bro-Botka2G","BSSId":"F0:9F:C2:A7:7D:9F","Channel":11,"RSSI":62,"Signal":-69,"LinkCount":1,"Downtime":"0T00:00:03"}}
18:19:38 MQT: temperature/tasmota_A0980C/SENSOR = {"Time":"2021-02-07T18:19:38","AM2301":{"Temperature":22.5,"Humidity":34.6,"DewPoint":6.1},"TempUnit":"C"}
18:24:33 MQT: temperature/tasmota_A0980C/HASS_STATE = {"Version":"9.2.0(tasmota)","BuildDateTime":"2020.12.21 15:09:06","Module or Template":"Generic","RestartReason":"Software/System restart","Uptime":"10T19:57:25","Hostname":"tasmota_A0980C-6156","IPAddress":"192.168.0.101","RSSI":"62","Signal (dBm)":"-69","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:03","MqttCount":1,"LoadAvg":19}
18:24:38 MQT: temperature/tasmota_A0980C/STATE = {"Time":"2021-02-07T18:24:38","Uptime":"10T19:57:30","UptimeSec":935850,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"WLAN-Bro-Botka2G","BSSId":"F0:9F:C2:A7:7D:9F","Channel":11,"RSSI":62,"Signal":-69,"LinkCount":1,"Downtime":"0T00:00:03"}}
18:24:38 MQT: temperature/tasmota_A0980C/SENSOR = {"Time":"2021-02-07T18:24:38","AM2301":{"Temperature":22.5,"Humidity":36.2,"DewPoint":6.7},"TempUnit":"C"}
18:29:33 MQT: temperature/tasmota_A0980C/HASS_STATE = {"Version":"9.2.0(tasmota)","BuildDateTime":"2020.12.21 15:09:06","Module or Template":"Generic","RestartReason":"Software/System restart","Uptime":"10T20:02:25","Hostname":"tasmota_A0980C-6156","IPAddress":"192.168.0.101","RSSI":"62","Signal (dBm)":"-69","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:03","MqttCount":1,"LoadAvg":19}
18:29:38 MQT: temperature/tasmota_A0980C/STATE = {"Time":"2021-02-07T18:29:38","Uptime":"10T20:02:30","UptimeSec":936150,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"WLAN-Bro-Botka2G","BSSId":"F0:9F:C2:A7:7D:9F","Channel":11,"RSSI":62,"Signal":-69,"LinkCount":1,"Downtime":"0T00:00:03"}}
18:29:38 MQT: temperature/tasmota_A0980C/SENSOR = {"Time":"2021-02-07T18:29:38","AM2301":{"Temperature":22.5,"Humidity":37.6,"DewPoint":7.3},"TempUnit":"C"}

I’ve set TelePeriod to 300 (5min).
Where do you assume a misconfiguration?

I tested the config that i shared with you and its working fine with the payload you shared. This means there is no issue with the config. Can you please check what is the state of the sensor.dht22_keller in developer console?

FYI you need to keep the teleperiod lowest like 10 or 15 so that the sensor value is updated frequently. If the teleperiod is 15 minutes, you will have to wait upto 15 minutes initially for the sensor to change from unavailable. Its advisable to change teleperiod to 10teleperiod 10

Developer Console with entity sensor.dht22_keller says state is unavailable ???

That’s not what I’ve expected. Does that mean mosquito isn’t working well? But how can I receive messages then in MQTTfx?
I’m really curious what I’ve missed out

Go to mqtt in integrations and then listen to temperature/tasmota_A0980C/SENSOR. Check if you are getting any payload.

Did you enable discovery? I think the hassio_state only comes in when discovery is on in Tasmota console… If you when you added the integration did you enable discovery there? If so then check the entities are enabled.
Note you don’t need any manual configuration at all if you use discovery

Ok I probably missed something.

I got to MQTT Settings and then to re-configure where I used my credentials.
I’ve missed that in tutorials I’ve watched, so now the value will be displayed and it seems to work.

But however I started now with mqtt, and hope gonna gain experience with it.
thanks for all the answers, I appreciated it!

1 Like