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'
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) :
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.