DHT Sensor - custom_components

To be clear, if you followed the steps described here, the custom component will never autoupdate.

Any idea how to revive DHT in version 2022.8.1?

Hello guys,
I have the same issue here. I am on 2022.8.1 and still no dht sensors
I have tried:
‘’’ to remove the dht folder from custom_components and the dht code from configuration.yaml → reboot → reinstall the folder with the files → reboot → reinsert the dht code on configuration.yaml ‘’’
thank you for your time

Where did you donwload the component from?

I try this on rpi3 with latest 2022.8.4.

I downloaded component from here and put dht folder under custom_components. Then I added "version": "1.0.0", line in the manifest.json file and restart ha.
After restsrt I added sensor under sensors and when I check configuration I get infinite loop.

Like this:

error:

Unable to install package adafruit-circuitpython-dht==3.7.0: error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [15 lines of output] running bdist_wheel running build running build_py Compiling ws281x library... creating build creating build/lib.linux-armv7l-cpython-310 creating build/lib.linux-armv7l-cpython-310/rpi_ws281x copying rpi_ws281x/rpi_ws281x.py -> build/lib.linux-armv7l-cpython-310/rpi_ws281x copying rpi_ws281x/__init__.py -> build/lib.linux-armv7l-cpython-310/rpi_ws281x running build_ext building '_rpi_ws281x' extension creating build/temp.linux-armv7l-cpython-310 creating build/temp.linux-armv7l-cpython-310/lib gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DTHREAD_STACK_SIZE=0x100000 -fPIC -I. -I/usr/local/include/python3.10 -c lib/dma.c -o build/temp.linux-armv7l-cpython-310/lib/dma.o error: command 'gcc' failed: No such file or directory [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for rpi_ws281x error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [15 lines of output] ****************************************************************************** * Setup can't determine the value of PAGE_SIZE on your system, so it will * default to 4096 which may not be correct. * * Please report this message and your operating system info to the package * maintainer listed in the README file. ****************************************************************************** running bdist_wheel running build running build_ext building 'sysv_ipc' extension creating build creating build/temp.linux-armv7l-cpython-310 gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.10 -c common.c -o build/temp.linux-armv7l-cpython-310/common.o error: command 'gcc' failed: No such file or directory [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for sysv_ipc error: subprocess-exited-with-error × Running setup.py install for sysv_ipc did not run successfully. │ exit code: 1 ╰─> [17 lines of output] ****************************************************************************** * Setup can't determine the value of PAGE_SIZE on your system, so it will * default to 4096 which may not be correct. * * Please report this message and your operating system info to the package * maintainer listed in the README file. ****************************************************************************** running install /usr/local/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( running build running build_ext building 'sysv_ipc' extension creating build creating build/temp.linux-armv7l-cpython-310 gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.10 -c common.c -o build/temp.linux-armv7l-cpython-310/common.o error: command 'gcc' failed: No such file or directory [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: legacy-install-failure × Encountered error while trying to install package. ╰─> sysv_ipc note: This is an issue with the package mentioned above, not pip. hint: See above for output from the failure.
Unable to install package RPi.GPIO==0.7.1a4: error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [15 lines of output] running bdist_wheel running build running build_py creating build creating build/lib.linux-armv7l-cpython-310 creating build/lib.linux-armv7l-cpython-310/RPi copying RPi/__init__.py -> build/lib.linux-armv7l-cpython-310/RPi creating build/lib.linux-armv7l-cpython-310/RPi/GPIO copying RPi/GPIO/__init__.py -> build/lib.linux-armv7l-cpython-310/RPi/GPIO running build_ext building 'RPi._GPIO' extension creating build/temp.linux-armv7l-cpython-310 creating build/temp.linux-armv7l-cpython-310/source gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.10 -c source/c_gpio.c -o build/temp.linux-armv7l-cpython-310/source/c_gpio.o error: command 'gcc' failed: No such file or directory [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for RPi.GPIO error: subprocess-exited-with-error × Running setup.py install for RPi.GPIO did not run successfully. │ exit code: 1 ╰─> [17 lines of output] running install /usr/local/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( running build running build_py creating build creating build/lib.linux-armv7l-cpython-310 creating build/lib.linux-armv7l-cpython-310/RPi copying RPi/__init__.py -> build/lib.linux-armv7l-cpython-310/RPi creating build/lib.linux-armv7l-cpython-310/RPi/GPIO copying RPi/GPIO/__init__.py -> build/lib.linux-armv7l-cpython-310/RPi/GPIO running build_ext building 'RPi._GPIO' extension creating build/temp.linux-armv7l-cpython-310 creating build/temp.linux-armv7l-cpython-310/source gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.10 -c source/c_gpio.c -o build/temp.linux-armv7l-cpython-310/source/c_gpio.o error: command 'gcc' failed: No such file or directory [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. WARNING: No metadata found in /usr/local/lib/python3.10/site-packages error: legacy-install-failure × Encountered error while trying to install package. ╰─> RPi.GPIO note: This is an issue with the package mentioned above, not pip. hint: See above for output from the failure.

Any idea what is wrong?

I think this addon is not compatible with latest Home assistant yet

:frowning:

same problem. No more support of dht en circuitpython? Any ideas?

This is very sad. The best thing about this solution was that only two wires were needed to get so much more information. Now I need a whole device more and for more money than just a small sensor!!!

@koying: It looks like the libraries no longer exist and thus the system can no longer include them. Couldn’t there be a way to import the libraries themselves and reference them in the manifest?

Yes.
Very sad

I’m always astounded by how strictly this “open source community” project is locked down to suite the blinkered goals of a few senior developers and prevent tinkering by the people using it. The usual line being that they don’t like having to offer support for projects people are hacking together, as if all such support would be on them, which is never true in a community project.
Yes, we should absolutely be able and allowed to install our own python packages. Though I note the python and pip commands are not accessible on the terminal. The packages are surely running somewhere though so we must be able to find the pip binary and ask it to install the relevant stuff we wish to import.
If anyone knows how to access Python or Pip from the hass terminal, please say so, because the official hass administration seems to be going down the same no-right-to-repair path as apple these days of saying “sure, go ahead and make changes, but we’re going to make it as hard as possible to do.” ¬_¬

Okay, so I’ve been poking around and just taking some notes as I go.

  1. Install the community add on “SSH & Web Terminal”
    i) Ensure it is “SSH & Web Terminal” and not the more “official” one called “Terminal & SSH”. Yes they look and sound identical, but this makes a huge difference.
    ii) Before starting the add on, click its “Configuration” tab and add a password (a key would be better but I’m keeping this simple for now).
    iii) Back on the Info tab, where you set it to start on boot etc, turn off the stupid switch for “Protection Mode”. This causes it to hide actually useful parts of the sytem from you if it’s on, such as Python, Pip, Docker, etc.
    iv) Start the addon and go to its web ui or login over an SSH terminal, however you prefer.
  2. In the now “unprotected” terminal, run pip3 install adafruit-circuitpython-dht (oh look, it does exist after all ¬_¬)
  3. Oh yes, the powers that be decided the primary benefit of using a Raspberry Pi over literally any other computer (it’s damned GPIO pins!) wasn’t important anymore, so we’d best install that too. pip3 install RPi.GPIO
  4. reboot

This is where I’m a bit stumped, after rebooting, nothing has changed and in fact if I run pip3 list the installed packages have now vanished.

However, I did notice that where my manifest file listed “RPi.GPIO==0.7.1a4” and “adafruit-circuitpython-dht==3.7.0”, what I’m seeing in my pip3 freeze is showing “RPi-GPIO==0.7.1” and “adafruit-circuitpython-dht==3.7.7” so I’m going to see what happens if I update the DHT custom component to use these newer versions…

1 Like

No luck I’m afraid. I still get, like @lpt2007, the infinite spinning configuration check.
Though curiously, I cannot see where @lpt2007 found their error lines regarding the packages not installing. I’ve checked the log section but all I see there is the usual moaning warnings about custom components not being official enough for their liking.

2 Likes

I’m running Homeassistant Core v2022.10.3 and DHT is not working, tried to update adafruit-circuitpython-dht and rpi.gpio and changed the requirements in the dht component, but the sensor is still not working and giving ‘unknown’ instead of the temperature and humidity values.

Updating Homeassistant
Looking in links: /tmp/tmp1kia4_s8
Requirement already satisfied: setuptools in ./lib/python3.9/site-packages (44.1.1)
Processing /tmp/tmp1kia4_s8/setuptools-44.1.1-py2.py3-none-any.whl
Requirement already satisfied: pip in ./lib/python3.9/site-packages (22.2.2)
Processing /tmp/tmp1kia4_s8/pip-20.3.4-py2.py3-none-any.whl
Requirement already satisfied: pkg_resources in ./lib/python3.9/site-packages (0.0.0)
Processing /tmp/tmp1kia4_s8/pkg_resources-0.0.0-py2.py3-none-any.whl
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: pip in ./lib/python3.9/site-packages (22.2.2)
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: hass-configurator in ./lib/python3.9/site-packages (0.5.1)
Requirement already satisfied: homeassistant in ./lib/python3.9/site-packages (2022.10.3)
Requirement already satisfied: onkyo-eiscp in ./lib/python3.9/site-packages (1.2.7)
Requirement already satisfied: adafruit-circuitpython-dht in ./lib/python3.9/site-packages (3.7.0)
Collecting adafruit-circuitpython-dht
  Downloading adafruit_circuitpython_dht-3.7.7-py3-none-any.whl (7.8 kB)
Requirement already satisfied: RPi.GPIO in ./lib/python3.9/site-packages (0.7.1a4)
Collecting RPi.GPIO
  Using cached https://www.piwheels.org/simple/rpi-gpio/RPi.GPIO-0.7.1-cp39-cp39-linux_armv7l.whl (66 kB)
Requirement already satisfied: pyotp in ./lib/python3.9/site-packages (from hass-configurator) (2.7.0)
Requirement already satisfied: gitpython in ./lib/python3.9/site-packages (from hass-configurator) (3.1.28)
Requirement already satisfied: ifaddr==0.1.7 in ./lib/python3.9/site-packages (from homeassistant) (0.1.7)
Requirement already satisfied: jinja2==3.1.2 in ./lib/python3.9/site-packages (from homeassistant) (3.1.2)
Requirement already satisfied: home-assistant-bluetooth==1.3.0 in ./lib/python3.9/site-packages (from homeassistant) (1.3.0)
Requirement already satisfied: yarl==1.8.1 in ./lib/python3.9/site-packages (from homeassistant) (1.8.1)
Requirement already satisfied: pyyaml==6.0 in ./lib/python3.9/site-packages (from homeassistant) (6.0)
Requirement already satisfied: python-slugify==4.0.1 in ./lib/python3.9/site-packages (from homeassistant) (4.0.1)
Requirement already satisfied: voluptuous-serialize==2.5.0 in ./lib/python3.9/site-packages (from homeassistant) (2.5.0)
Requirement already satisfied: certifi>=2021.5.30 in ./lib/python3.9/site-packages (from homeassistant) (2022.9.24)
Requirement already satisfied: httpx==0.23.0 in ./lib/python3.9/site-packages (from homeassistant) (0.23.0)
Requirement already satisfied: typing-extensions<5.0,>=4.4.0 in ./lib/python3.9/site-packages (from homeassistant) (4.4.0)
Requirement already satisfied: ciso8601==2.2.0 in ./lib/python3.9/site-packages (from homeassistant) (2.2.0)
Requirement already satisfied: attrs==21.2.0 in ./lib/python3.9/site-packages (from homeassistant) (21.2.0)
Requirement already satisfied: PyJWT==2.5.0 in ./lib/python3.9/site-packages (from homeassistant) (2.5.0)
Requirement already satisfied: voluptuous==0.13.1 in ./lib/python3.9/site-packages (from homeassistant) (0.13.1)
Requirement already satisfied: bcrypt==3.1.7 in ./lib/python3.9/site-packages (from homeassistant) (3.1.7)
Requirement already satisfied: awesomeversion==22.9.0 in ./lib/python3.9/site-packages (from homeassistant) (22.9.0)
Requirement already satisfied: async-timeout==4.0.2 in ./lib/python3.9/site-packages (from homeassistant) (4.0.2)
Requirement already satisfied: lru-dict==1.1.8 in ./lib/python3.9/site-packages (from homeassistant) (1.1.8)
Requirement already satisfied: atomicwrites-homeassistant==1.4.1 in ./lib/python3.9/site-packages (from homeassistant) (1.4.1)
Requirement already satisfied: requests==2.28.1 in ./lib/python3.9/site-packages (from homeassistant) (2.28.1)
Requirement already satisfied: orjson==3.7.11 in ./lib/python3.9/site-packages (from homeassistant) (3.7.11)
Requirement already satisfied: astral==2.2 in ./lib/python3.9/site-packages (from homeassistant) (2.2)
Requirement already satisfied: aiohttp==3.8.1 in ./lib/python3.9/site-packages (from homeassistant) (3.8.1)
Requirement already satisfied: pip<22.3,>=21.0 in ./lib/python3.9/site-packages (from homeassistant) (22.2.2)
Requirement already satisfied: cryptography==38.0.1 in ./lib/python3.9/site-packages (from homeassistant) (38.0.1)
Requirement already satisfied: frozenlist>=1.1.1 in ./lib/python3.9/site-packages (from aiohttp==3.8.1->homeassistant) (1.3.1)
Requirement already satisfied: multidict<7.0,>=4.5 in ./lib/python3.9/site-packages (from aiohttp==3.8.1->homeassistant) (6.0.2)
Requirement already satisfied: charset-normalizer<3.0,>=2.0 in ./lib/python3.9/site-packages (from aiohttp==3.8.1->homeassistant) (2.1.1)
Requirement already satisfied: aiosignal>=1.1.2 in ./lib/python3.9/site-packages (from aiohttp==3.8.1->homeassistant) (1.2.0)
Requirement already satisfied: pytz in ./lib/python3.9/site-packages (from astral==2.2->homeassistant) (2022.4)
Requirement already satisfied: six>=1.4.1 in ./lib/python3.9/site-packages (from bcrypt==3.1.7->homeassistant) (1.16.0)
Requirement already satisfied: cffi>=1.1 in ./lib/python3.9/site-packages (from bcrypt==3.1.7->homeassistant) (1.15.1)
Requirement already satisfied: bleak>=0.14.3 in ./lib/python3.9/site-packages (from home-assistant-bluetooth==1.3.0->homeassistant) (0.18.1)
Requirement already satisfied: httpcore<0.16.0,>=0.15.0 in ./lib/python3.9/site-packages (from httpx==0.23.0->homeassistant) (0.15.0)
Requirement already satisfied: sniffio in ./lib/python3.9/site-packages (from httpx==0.23.0->homeassistant) (1.3.0)
Requirement already satisfied: rfc3986[idna2008]<2,>=1.3 in ./lib/python3.9/site-packages (from httpx==0.23.0->homeassistant) (1.5.0)
Requirement already satisfied: MarkupSafe>=2.0 in ./lib/python3.9/site-packages (from jinja2==3.1.2->homeassistant) (2.1.1)
Requirement already satisfied: text-unidecode>=1.3 in ./lib/python3.9/site-packages (from python-slugify==4.0.1->homeassistant) (1.3)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./lib/python3.9/site-packages (from requests==2.28.1->homeassistant) (1.26.12)
Requirement already satisfied: idna<4,>=2.5 in ./lib/python3.9/site-packages (from requests==2.28.1->homeassistant) (3.4)
Requirement already satisfied: netifaces in ./lib/python3.9/site-packages (from onkyo-eiscp) (0.11.0)
Requirement already satisfied: docopt>=0.4.1 in ./lib/python3.9/site-packages (from onkyo-eiscp) (0.6.2)
Requirement already satisfied: Adafruit-Blinka in ./lib/python3.9/site-packages (from adafruit-circuitpython-dht) (8.5.0)
Requirement already satisfied: rpi-ws281x>=4.0.0 in ./lib/python3.9/site-packages (from Adafruit-Blinka->adafruit-circuitpython-dht) (4.3.4)
Requirement already satisfied: adafruit-circuitpython-typing in ./lib/python3.9/site-packages (from Adafruit-Blinka->adafruit-circuitpython-dht) (1.8.2)
Requirement already satisfied: pyftdi>=0.40.0 in ./lib/python3.9/site-packages (from Adafruit-Blinka->adafruit-circuitpython-dht) (0.54.0)
Requirement already satisfied: sysv-ipc>=1.1.0 in ./lib/python3.9/site-packages (from Adafruit-Blinka->adafruit-circuitpython-dht) (1.1.0)
Requirement already satisfied: Adafruit-PlatformDetect>=3.13.0 in ./lib/python3.9/site-packages (from Adafruit-Blinka->adafruit-circuitpython-dht) (3.31.0)
Requirement already satisfied: Adafruit-PureIO>=1.1.7 in ./lib/python3.9/site-packages (from Adafruit-Blinka->adafruit-circuitpython-dht) (1.1.9)
Requirement already satisfied: gitdb<5,>=4.0.1 in ./lib/python3.9/site-packages (from gitpython->hass-configurator) (4.0.9)
Requirement already satisfied: dbus-fast<2.0.0,>=1.4.0 in ./lib/python3.9/site-packages (from bleak>=0.14.3->home-assistant-bluetooth==1.3.0->homeassistant) (1.33.0)
Requirement already satisfied: pycparser in ./lib/python3.9/site-packages (from cffi>=1.1->bcrypt==3.1.7->homeassistant) (2.21)
Requirement already satisfied: smmap<6,>=3.0.1 in ./lib/python3.9/site-packages (from gitdb<5,>=4.0.1->gitpython->hass-configurator) (5.0.0)
Requirement already satisfied: h11<0.13,>=0.11 in ./lib/python3.9/site-packages (from httpcore<0.16.0,>=0.15.0->httpx==0.23.0->homeassistant) (0.12.0)
Requirement already satisfied: anyio==3.* in ./lib/python3.9/site-packages (from httpcore<0.16.0,>=0.15.0->httpx==0.23.0->homeassistant) (3.6.1)
Requirement already satisfied: pyusb!=1.2.0,>=1.0.0 in ./lib/python3.9/site-packages (from pyftdi>=0.40.0->Adafruit-Blinka->adafruit-circuitpython-dht) (1.2.1)
Requirement already satisfied: pyserial>=3.0 in ./lib/python3.9/site-packages (from pyftdi>=0.40.0->Adafruit-Blinka->adafruit-circuitpython-dht) (3.5)
Requirement already satisfied: adafruit-circuitpython-requests in ./lib/python3.9/site-packages (from adafruit-circuitpython-typing->Adafruit-Blinka->adafruit-circuitpython-dht) (1.12.8)
Requirement already satisfied: adafruit-circuitpython-busdevice in ./lib/python3.9/site-packages (from adafruit-circuitpython-typing->Adafruit-Blinka->adafruit-circuitpython-dht) (5.2.3)
Installing collected packages: RPi.GPIO, adafruit-circuitpython-dht
  Attempting uninstall: RPi.GPIO
    Found existing installation: RPi.GPIO 0.7.1a4
    Uninstalling RPi.GPIO-0.7.1a4:
      Successfully uninstalled RPi.GPIO-0.7.1a4
  Attempting uninstall: adafruit-circuitpython-dht
    Found existing installation: adafruit-circuitpython-dht 3.7.0
    Uninstalling adafruit-circuitpython-dht-3.7.0:
      Successfully uninstalled adafruit-circuitpython-dht-3.7.0
Successfully installed RPi.GPIO-0.7.1 adafruit-circuitpython-dht-3.7.7
Starting Homeassistant...

Also tried this custom_component: GitHub - richardzone/homeassistant-dht: Support for Adafruit DHT temperature and humidity sensor and still the same errors.

I got it working using a hardware ‘hack’ using the 5v instead of the 3.3v of the raspberry pi and now getting values for humidity and temperature, using above custom_component.

How did you do working???
Regards

Hi,
The verison of RPi.GPIO requested by dht is 0.7.1a4, while its version in rpi_GPIO is v0.7.1. The system needs gcc to compile the python wheel of RPi.GPIO v0.7.1a4. But you can simply use the same version of it in dht library. Just remove “a4” from the manifest.json of dht library.
It worked for home assistant os on raspberry pi.

1 Like

Hi - can you be slightly more expansive on this please? I removed a4 but am assuming there is another library I need to add as it’s not go things working…

Ok. It’s working now!
Simple instruction:

  1. Remove the dht directory in \config\custom_components
  2. (As suggest by @megapearl ) Add this repository to HACS GitHub - richardzone/homeassistant-dht: Support for Adafruit DHT temperature and humidity sensor and install the component.
  3. (As suggest by @jiawku ) Edit the file \config\custom_components\dht\manifest.json and remove “a4” from the “0.7.1a4”.
  4. Reboot Home Assistant.
  5. Add the code in your .yaml file.
  6. Check config (it should pass now) and reboot.
5 Likes

Thanks, I’ve followed the instruction but now my config.yaml won’t pass before restart…will have to tinker a little more

You have to restart Home Assistant before adding the configuration lines in the config.yaml. After the DHT integration is installed, then Home Assistant will pass you configuration code if it’s correctly formed. You can also restart the host, via settings, system, hardware if Home Assistant isn’t allowing to restart.

However I am personnaly struggling to get the DHT sensor on the Raspberry GPIOs working as well. Restarting and adding the code is working, but no values yet on the sensor.

Here’s my log:

Logger: custom_components.dht.sensor
Source: custom_components/dht/sensor.py:193
Integration: dht (documentation, issues)
First occurred: 19:17:30 (16 occurrences)
Last logged: 19:21:09

Finished call to 'custom_components.dht.sensor.DHTClient.read_retry' after 0.376(s), this was the 1st time calling it.
Finished call to 'custom_components.dht.sensor.DHTClient.read_retry' after 0.373(s), this was the 1st time calling it.
1 Like