Hi,
I am currently running Home Assistant in Docker using an image from https://hub.docker.com/r/homeassistant/home-assistant/ (v0.68.1) on a Raspberry Pi 3.
I have connected a DHT22 temperature and humidity sensor to the GPIO’s of the RasPi, but can’t get Home Assistant to read values from it. In my configuration.yaml
I have added the following entry:
sensor:
- platform: yr
- platform: dht
sensor: DHT22
pin: 4
monitored_conditions:
- temperature
- humidity
The error log of home assistant tells me, that there is an error accessing GPIO.
dht: Error on device update!
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 244, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 327, in async_device_update
yield from self.hass.async_add_job(self.update)
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/python3.6/site-packages/homeassistant/components/sensor/dht.py", line 125, in update
self.dht_client.update()
File "/usr/lib/python3.6/site-packages/homeassistant/util/__init__.py", line 319, in wrapper
result = method(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/homeassistant/components/sensor/dht.py", line 160, in update
self.sensor, self.pin)
File "/usr/lib/python3.6/site-packages/Adafruit_DHT/common.py", line 94, in read_retry
humidity, temperature = read(sensor, pin, platform)
File "/usr/lib/python3.6/site-packages/Adafruit_DHT/common.py", line 81, in read
return platform.read(sensor, pin)
File "/usr/lib/python3.6/site-packages/Adafruit_DHT/Raspberry_Pi_2.py", line 34, in read
raise RuntimeError('Error accessing GPIO.')
RuntimeError: Error accessing GPIO.
On a normal Raspbian install this error usually occurs due to the user running home assistant not being in the GPIO group. The GPIO group in turn has access to /dev/gpiomem
, which is needed to access the GPIO pins.
I tried giving access to the Docker container running home assistant by giving it access to /dev/gpiomem
and by running it in privileged mode. by adding the following entries to my docker-compose.yaml
.
..
volumes:
..
- /dev/mem:/dev/mem
..
privileged: true
..
Neither of them resolved my problem.
Any idea to debug this problem would be appreciated.
Kind regards