DHT11 - temp ok, but RH values wildly off

I was having trouble with wildly fluctuating values for both temperature and humidity with a DHT11 using a NodeMCU 1.0 board. The humidity would periodically be in the 150-160% range, while the temperature would drop to 0.

Here's what I did to solve it.

  • Switched from the Adafruit DHT library to the DHTesp library.
  • Changed from INPUT to INPUT_PULLUP on the GPIO pin in my sketch.

You can see on the attached charts from Home Assistant when I updated the sketch, as the temp and humidity values immediately stabilized.

Just thought anybody else trying to get their DHT11 working might want to know.