# DHT usermod with DHT22

**URL:** <https://wled.discourse.group/t/dht-usermod-with-dht22/3467>\
**Category:** Usermods\
**Created:** [August 27, 2021, 11:14am UTC](https://wled.discourse.group/t/dht-usermod-with-dht22/3467 "2021-08-27T11:14:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andras](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/andras/32/1899_2.png) [@Andras](https://wled.discourse.group/u/Andras)\
**Post date:** [August 27, 2021, 11:14am UTC](https://wled.discourse.group/t/dht-usermod-with-dht22/3467/1 "2021-08-27T11:14:13Z")

</div>

Hi All,

I am using the latest 0.12.0 version of wled on a wemos esp32 board and I was trying to get the DHT usermod with a DHT22 sensor working, but unfortunatelly I can’t get a sensor reading.  
The ` if (dht_sensor.measure(&tempC, &humidity)) {` condition always returns false for me.  
I tried to revert back to a previous version where the esp32DHT library was used from bertmelis, but it is all the same.  
The sensor seems to be fine, I tried it out with Tasmota and also by running the example code from [GitHub - alwynallan/DHT\_nonblocking: Non-blocking Arduino library for the DHT11, DHT21, and DHT22](https://github.com/alwynallan/DHT_nonblocking) and in both cases the sensor worked.

I simply added the following build flags to the esp32dev env in platformio.ini for the custom build.

```auto
[env:esp32dev]
board = esp32dev
platform = espressif32@2.0
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32 -D USERMOD_DHT -D USERMOD_DHT_CELSIUS -D USERMOD_DHT_MEASUREMENT_INTERVAL=60000 -D USERMOD_DHT_FIRST_MEASUREMENT_AT=90000 -D USERMOD_DHT_PIN=21 -D ARDUINO_ARCH_ESP32
lib_deps = ${esp32.lib_deps}
   https://github.com/alwynallan/DHT_nonblocking
   

```

Any help is appreciated.

Thanks,  
Andras
