Error setting up DHT11 sensor

I am running hassio on RP3, and I am trying to set up a DHT11 sensor connected to the GPIO

I get the following error in the log:

2017-08-13 16:58:29 ERROR (SyncWorker_19) [homeassistant.util.package] Unable to install package https://github.com/adafruit/Adafruit_Python_DHT/archive/da8cddf7fb629c1ef4f046ca44f42523c9cf2d11.zip#Adafruit_DHT==1.3.2: Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-s2_1jj2b-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-tndp5ueq-record/install-record.txt --single-version-externally-managed --prefix  --compile --user --prefix=" failed with error code 1 in /tmp/pip-s2_1jj2b-build/
2017-08-13 16:58:29 ERROR (MainThread) [homeassistant.setup] Not initializing sensor.dht because could not install dependency https://github.com/adafruit/Adafruit_Python_DHT/archive/da8cddf7fb629c1ef4f046ca44f42523c9cf2d11.zip#Adafruit_DHT==1.3.2
2017-08-13 16:58:29 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform sensor.dht: Could not install all requirements.

Please advise

Hi, I am getting the same with a new install of 0.51 on a Pi2. My 0.50.2 works fine, but breaks when I do an update. The DHT22 sensor stops working.

DHT22 is now broken for me as well as of 0.51 up to 0.51.2. 0.50.2 works fine. Same setup, have a Raspberry Pi 3 and the DHT22 plugged into GPIO on the Pi.

I get either Temperature, or Humidity, but I don’t get both measurements in the front end even though I have them both setup as monitored conditions. It seems like a race condition determines which one gets updated and which one never gets reported after reboot.

Here’s my DHT22 config:

  - platform: dht
    sensor: DHT22
    name: Living Room
    pin: 2
    monitored_conditions:
      - temperature
      - humidity
    temperature_offset: 0
    humidity_offset: 0

Here’s the error I get in the console after HASS has started - in this case, Temperature is working fine but Humidity isn’t:

2017-08-12 19:30:36 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
    result = coro.throw(exc)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 381, in async_process_entity
    new_entity, self, update_before_add=update_before_add
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 212, in async_add_entity
    yield from self.hass.async_add_job(entity.update)
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/sensor/dht.py", line 139, in update
    humidity = data[SENSOR_HUMIDITY]
KeyError: 'humidity'

Same here with 51.x
Einher temp or humidity with same error log.

Same for me after upgrading to 51.x with Pi3 and DHT22. Any idea?

This has already been logged. Someone has posted a quick fix until the issue is resolved

Thanks a lot, it is working again! +1

The problem I posted has a different error message than what buzzeddesign posted, neither the temperature nor the humidy sensors will initialize… can anyone help me fix it?

Some time ago I had similar problems while played with DHT11 sensor and installed several different libraries.
If you take a look at the file /srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/sensor/dht.py (for HA installed in virtual environment) you’d see the in line 21:
REQUIREMENTS = [‘https://github.com/adafruit/Adafruit_Python_DHT/archive/
‘da8cddf7fb629c1ef4f046ca44f42523c9cf2d11.zip’
‘#Adafruit_DHT==1.3.2’]
I played with version number and changed it to older or newer ones (e.g. ==1.3.0).

Also I installed required module manually with the following command sequence (just example) :

sudo systemctl stop [email protected]
sudo su -s /bin/bash homeassistant
source /srv/homeassistant/bin/activate
pip3 install Adafruit_DHT==1.3.2

You can try it I suppose…

Hello. I just installed HassIO on a RPI 2, connected an Arduino board to it with a few sensors which are working fine. I’m trying now to connect a DHT22 sensor and this error occurs:
2017-08-25 16:04:02 ERROR (SyncWorker_5) [homeassistant.util.package] Unable to install package https://github.com/adafruit/Adafruit_Python_DHT/archive/da8cddf7fb629c1ef4f046ca44f42523c9cf2d11.zip#Adafruit_DHT==1.3.2: Command “/usr/bin/python3 -u -c “import setuptools, tokenize;file=’/tmp/pip-ateqae1r-build/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-1u37ydiy-record/install-record.txt --single-version-externally-managed --prefix --compile --user --prefix=” failed with error code 1 in /tmp/pip-ateqae1r-build/
2017-08-25 16:04:02 ERROR (MainThread) [homeassistant.setup] Not initializing sensor.dht because could not install dependency https://github.com/adafruit/Adafruit_Python_DHT/archive/da8cddf7fb629c1ef4f046ca44f42523c9cf2d11.zip#Adafruit_DHT==1.3.2
2017-08-25 16:04:02 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform sensor.dht: Could not install all requirements.

Can anyone guide me to a fix, please?

I have the same dependency issue trying to setup a DHT22 on hassio 0.52.1:

Unable to install package https://github.com/adafruit/Adafruit_Python_DHT/archive/da8cddf7fb629c1ef4f046ca44f42523c9cf2d11.zip#Adafruit_DHT==1.3.2: Command “/usr/bin/python3 -u -c “import setuptools, tokenize;file=’/tmp/pip-a9un559j-build/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-gds_gjun-record/install-record.txt --single-version-externally-managed --prefix --compile --user --prefix=” failed with error code 1 in /tmp/pip-a9un559j-build/

And:

[homeassistant.setup] Not initializing sensor.dht because could not install dependency https://github.com/adafruit/Adafruit_Python_DHT/archive/da8cddf7fb629c1ef4f046ca44f42523c9cf2d11.zip#Adafruit_DHT==1.3.2

The package https://github.com/adafruit/Adafruit_Python_DHT/archive/da8cddf7fb629c1ef4f046ca44f42523c9cf2d11.zip exists and is downloadable . . .

The GitHub issue #8976 doesn’t seem related . . .that I can tell anyway.