Make sure you are running the latest version of Home Assistant before reporting an issue.
You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:
Home Assistant release (hass --version
):
0.51
Python release (python3 --version
):
Python 3.4.2
Component/platform:
DHT22
Description of problem:
DHT22 Humidity and Temp sensor only shows either Hum or Temp. Error log below.
Expected:
Problem-relevant configuration.yaml
entries and steps to reproduce:
sensor:
- platform: dht
sensor: DHT22
pin: 24
name: 'Hallway'
monitored_conditions:
- temperature
- humidity
Traceback (if applicable):
2017-08-13 21:53:52 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 "/usr/local/lib/python3.4/dist-packages/homeassistant/helpers/entity_component.py", line 381, in async_process_entity
new_entity, self, update_before_add=update_before_add
File "/usr/local/lib/python3.4/dist-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 "/usr/local/lib/python3.4/dist-packages/homeassistant/components/sensor/dht.py", line 139, in update
humidity = data[SENSOR_HUMIDITY]
KeyError: 'humidity'
Additional info:
Same for me, but for temperature. Humidity works fine.
temperature error +1
[UPDATE] after upgraded to 0.51.2, I got humidity
keyerror too.
Same for me.
Also temperature error here, humidity works fine.
After upgrade to 0.51.2 , I got all this errors too. After that, I proceed a completely uninstall and did a new instalation, all errors still there.
I worked out with a quick fix:
homeassistant $ vi /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/sensor/dht.py
# line 131, mod to
temperature = data.get(SENSOR_TEMPERATURE, 0)
#line 139, mod to
humidity = data.get(SENSOR_HUMIDITY, 0)
This is really a quickfix, it's not fixing the issue to the ground, still waiting the official fix.
+1
KillingJacky workarround works like a charm ! thank you
Im not using the Python Virtual Env, so i dont have .../homeassistant/components/sensor/ folder.. :/
I might reinstall my pies with HASS.io at this point.
@GMFalka The equivalent folder is availble on any HA installation even if you not using a VEnv.
KillingJacky, with your quick fix, it's working fine now! thank you
The fix works. Thanks!
@Landrash
This is how it looks at my two pies and xubuntu too (i have 3 HA instance in the house)
@GMFalka The file in question is not located where your looking but where HA is installed. Most likely where your installation stores it's python libraries.
check the path on the error message.
it even says the line
@migromao
Thanks! I'm a goofus!
Thank you KillingJacky! Now it's working fine again.
Thanks to KillingJacky that sensor alive again!
@KillingJacky Thanks for the tip. Did you already made the PR? I can't find it.
How can i use this quickfix on hassio these folders doesnot exist
How can i use this quickfix on hassio these folders doesnot exist
Why don't you try to search that file?
sudo find / -name dht.py -print
Why don't you try to search that file?
sudo find / -name dht.py -print
core-ssh:~# find / -name *.py -print
/config/deps/lib/python3.6/site-packages/Adafruit_DHT/Test.py
/config/deps/lib/python3.6/site-packages/Adafruit_DHT/Raspberry_Pi_2.py
/config/deps/lib/python3.6/site-packages/Adafruit_DHT/common.py
/config/deps/lib/python3.6/site-packages/Adafruit_DHT/__init__.py
/config/deps/lib/python3.6/site-packages/Adafruit_DHT/platform_detect.py
/config/deps/lib/python3.6/site-packages/Adafruit_DHT/Beaglebone_Black.py
/config/deps/lib/python3.6/site-packages/Adafruit_DHT/Raspberry_Pi.py
/usr/share/vim/vim80/tools/demoserver.py
now what ?
@namadori Not yet, as I think it's not the best way to solve this issue, it will produce at least one useless 0
reading for either temperature or humidity.
My PR that should hopefully fix the issue has been merged.
Most helpful comment
I worked out with a quick fix:
This is really a quickfix, it's not fixing the issue to the ground, still waiting the official fix.