Can't get DHT11 Sensor to work

So, I bought this DHT11 sensor (actually got 2 - both don’t work),

connected it to 5V, GPIO17 and GND and, following this guide, set it up in the configuration.yaml like that:

  - platform: dht
    sensor: DHT11 #also tried DHT22 and AM2302
    pin: 17 # also tried 11, because GPIO17 is pin 11
      - temperature
      - humidity

It does not work… the sensor value is always “unknown”

I have also tried to connect it to a 3,3V pin, no success…

What am I doing wrong?

Additional info:
Since I’m going to add a CO2 sensor too, I followed this guide , to enable running it directly on the pi. Other than that, it’s pretty much a fresh install of Home Assistant on a Pi 3 B+

In the System Core logs the only errors about that, are these lines:

2020-08-21 09:45:27 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.raumklima_temperature is taking over 10 seconds

Updating dht sensor took longer than the scheduled update interval 0:00:30

I already checked this thread Problems with DHT sensor platorm but can’t make much of it…

Try to replace the pin number pin with the actual GPIO

  - platform: dht
    pin: GPIO2
    model: DHT11
      name: "ESP CAM Temperature"
      name: "ESP CAM Humidity"
    update_interval: 60s

If the above doesn’t help, do you have spare Wemos / NodeMCU floating around you could test it on ?

This works for you?! It looks completely different form the documentation - and my Homeassistant won’t even reboot if I copy paste your config :thinking:

unfortunately no - but I doubt both sensors I bought are broken

Edit: Ok, I’m wrong. I was thinking you use an esp, but rereading your first post, I think you want to connect your dht11 to a raspberry pi ?

It is a snippet from an actual working firmware.

This is the actual device

  name: esp_cam
  platform: ESP32
  board: esp-wrover-kit

  ssid: "SNOW"
  password: "xxx"
    ssid: "ESP CAM"
    password: "xxx"

# Enable OTA updates
  safe_mode: True

    pin: GPIO0
    frequency: 20MHz
    sda: GPIO26
    scl: GPIO27
  data_pins: [GPIO5, GPIO18, GPIO19, GPIO21, GPIO36, GPIO39, GPIO34, GPIO35]
  vsync_pin: GPIO25
  href_pin: GPIO23
  pixel_clock_pin: GPIO22
  power_down_pin: GPIO32
  name: ESP32Camera
  horizontal_mirror: false
  resolution: 320x240

  - platform: dht
    pin: GPIO2
    model: DHT11
      name: "ESP CAM Temperature"
      name: "ESP CAM Humidity"
    update_interval: 60s

Oh - we are trying to do different things I think…

I want to connect the sensor directly to the Pi :wink:

How certain are you that you’re connected to gpio17 ?
Can you try another GPIO, other connecting wires ?

99.9% in the picture, the 6th from the top, on the left (pin 11)

I tried pretty much all of them (I know I tried 17, 27, 22, 14 and 15)

In Lovelace it says “Entity is non-numerical” (which is logical, because the sensors shows “unknown”)

translation: “entity is non-numerical”

translation: “unknown”

I found an Arduino nano, connected the DHT11 and the sensor itself works fine.


It must be a Home Assistant (or more likely, me) problem :frowning:

Ok, it seems like something’s seriously wrong with GPIO sensors in Home Assistant…

My door sensor doesn’t work reliably either … Pi GPIO Binary Sesnsor

Interestingly - and luckily, switching relays with the GPIOs works flawlessly.

I find it quite frustrating that the GPIO sensors don’t seem to work the way they should - this would be such a great and easy way to monitor things like the temperature, humidity, or the door state in/of the server cabinet, without wasting expensive wireless sensors :frowning:

At least you’ve narowed down the problem :grimacing:

I don’t know if you still have the problem.

But i have the exact same setup as you have in this post and mine is working.

But i have see others having problems using GPIO 17 but no problems with GPIO 04 (PIN 7)

Maybe it will help you too.

1 Like

try this. it works for me
name: officetemp
board: nodemcuv2
- platform: dht
pin: D2
name: “Office Room Temperature”
name: “Office Room Humidity”
update_interval: 30s