DHT Sensor not working


I am new to Home Assistant and I have a small issue with the DHT Sensor component. The sensor didn’t show in the Debug Tools > Current Entities.

Did someone know how to show the sensors temperature and humidity?

I started hass with sudo permissions and the DHT component seems to be loaded correctly.
INFO:homeassistant.loader:Loaded sensor.dht from homeassistant.components.sensor.dht

This is my sensor config :

- platform: dht
  sensor: DHT11
  pin: 17
  name: Mechanical Room
    - temperature
    - humidity

I tried the examples of the library Adafruit_Python_DHT used in components/sensor/dht.py and they work properly.

Thanks for your help.

Here it looks that your entry is malformed. In the past it was also necessary to run Home Assistant as root to access the GPIOs.

I really don’t see which part of the entry can be malformed. I double checked everything.

In the config I use a 2 spaces indentation. All other sensors work fine with this indentation.
I tested with sudo and without.

  • With sudo, the component seems to be loaded: INFO:homeassistant.loader:Loaded sensor.dht from homeassistant.components.sensor.dht
  • Without sudo, a message appears : RuntimeError: Error accessing GPIO. Make sure program is run as root with sudo!

My DHT11 is connected to the pin 17 following this pinout diagram from raspberrypi.org. I also tested in other pins and still no entity seen in HA.

The given sample is missing the indent.