DHT22 sensors reporting bad values in ESPHome

I have built a couple of devices with ESP8266 NodeMCU controllers, which I initially programmed myself with the Arduino IDE, but flashed them both with ESPHome.
One has a DHT22 sensor for temp and humidity, and the other has a DHT22 and also a BMP280.

Last night both were working fine, then I did an “update all” to all my ESPHOME devices and this morning the values from the DHT22 sensors are way out:

Box 1, with a DHT22 and a BMP280 (the first temp value is from the BMP280):

[11:38:36][D][sensor:099]: ‘Greenhouse Temperature’: Sending state 25.10000 °C with 1 decimals of accuracy
[11:38:42][D][sensor:099]: ‘DHT Temperature’: Sending state -9.70000 °C with 1 decimals of accuracy
[11:38:42][D][sensor:099]: ‘Greenhouse Humidity’: Sending state 23.00000 % with 0 decimals of accuracy

Box 2, with a DHT22:

[11:40:37][D][sensor:099]: ‘Garden Temperature’: Sending state -6.20000 °C with 1 decimals of accuracy
[11:40:37][D][sensor:099]: ‘Garden Humidity’: Sending state 6.30000 % with 0 decimals of accuracy

They are both sitting on my table indoors at the moment. By comparison, last night the humidity was around 50% and the temp is in the 20’s.

The YAML looks like this:

sensor:
  - platform: bmp280
    temperature:
      name: "Greenhouse Temperature"
      oversampling: 16x
    pressure:
      name: "Greenhouse Pressure"
    address: 0x76
    update_interval: 30s
    
  - platform: dht
    pin: D5
    temperature:
      name: "DHT Temperature"
    humidity:
      name: "Greenhouse Humidity"
    update_interval: 30s

Would this be caused by an ESPHome update? If so, is there a way of a) rolling back to a previous version, and b) reporting the problem?

I’m very new to this, so thanks in advance for any help.

1 Like

Try adding the model:

  - platform: dht
    pin: D5
    model: DHT22
    temperature:
      name: "DHT Temperature"
    humidity:
      name: "Greenhouse Humidity"
    update_interval: 30s

Auto detect does not work well.

13 Likes

I’m sure that was in there before, no idea why it got deleted.
Problem solved - Thank you so much!!! :grinning:

1 Like

I have just recently had to make a new sensor to subtract 2.3 from humidity and 1.6 from Temperature. to have this sensor match my two BMP280’s. And I have always had the model DHT22 included.

You don’t have to make a new sensor to do that. You can apply an offset filter to the existing sensor in ESPHome.

2 Likes

This thread just saved me from pulling out the few hairs I have left on top of my head. :crazy_face:

1 Like

had the same problem… fixed… thanks guys, thanks @tom_l

1 Like

Same issue here today… Thanks Tom

Hello,

I have configured esp8266 nodemcu with dht22 (am2302)
i gave added model value am2302 on my config, (writed on box of dht22), so not i had negative temperature.
Now température is ok,

But humidity seem not true (tested with 2 dht22)
i have 39% humidty with the twoo dht22
And i have with dyson and netatmo 54% of humidty in same room. so they are delta about 15%?

my esphome config

  - platform: dht
    pin: GPIO2  #D4
    temperature:
      name: "Air quality meter Temperature"
    humidity:
      name: "Air quality meter Humidity"
    update_interval: 20s
    model: AM2302

Best regards.

2 Likes

I found huge variance between devices and also locations within rooms, particularly humidity. I would use a template to arrive at an average and/ or an offset / linear filter once you have decided which one to calibrate to. If you run say 5 DHT11 next to each other how close are they to each other? I am about to go through the exercise of working out which sensors to use

All my DHT22s are within 5% of each other and agree nicely with my dehumidifier.

DHT11 are less accurate than the DHT22.

If you want to calibrate a humidity sensor you can do it with a salt slurry.

Hello, JulienDH ans Tom_I,

Thanks so much to your fast response,

I will try to place them in same position on the room cause actualy dht is around 1,5m of other humidity sensors, i reading on some forum, also it’s pereferable to place dht22 to 5V instead 3.3v to have a better precision ?
So is not i will use linear filter.
I will make dupont cable on to twoo for 5v vout of esp8266. (cause i use esp on usb powered mode).

Best regards.

… and me too - thanks for the fix. I was getting -12deg & 2% humidity (real was 22 & 50%). EspHome has an example yaml that doesn’t include model: so newbies (like me) are going to wonder what’s going on!

1 Like

It’s almost always a good idea to read all the available options rather than just copying the example.

2 Likes

I literally just went through the steps of resetting my password to thank you personally! Thank you so much!
One thing to add for the Googlers: My issue was that the sensor reported correctly immediately after flashing a new firmware, but as soon as I disconnected power from the ESP8266 and reconnected it, it started reporting these weird values. Now everything works fine, thank you!

I have setup 3 ESP32 with DHT22 no problem then the 8266 was giving me strange numbers. 3 days trying to figure it out till I see what you did adding the model: AM2302 worked like a charm thank you.

1 Like