Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adafruit_DHT (DHT22, ...) package is deprecated on Raspberry Pi #373

Open
eMindFfM opened this issue Jun 19, 2024 · 5 comments
Open

Adafruit_DHT (DHT22, ...) package is deprecated on Raspberry Pi #373

eMindFfM opened this issue Jun 19, 2024 · 5 comments

Comments

@eMindFfM
Copy link

Adafruit_DHT (DHT22, ...) package is deprecated on Raspberry Pi and can not be installed any longer, thus the package can not run.

an alternative is package provided adafruit-circuitpython-dht

Source: https://github.com/adafruit/Adafruit_CircuitPython_DHT

Can you please update

@mschlenstedt
Copy link
Contributor

Installed via apt or pip? Installation should still be possible via pip.

@eMindFfM
Copy link
Author

eMindFfM commented Jun 20, 2024

with the "normal" pip it did not work at all.
I found out that you can force manually the installation

pip3 install Adafruit_DHT --install-option="--force-pi"

This is only allowed in an virtual environment

Now I'm getting some strange "plattform" errors related to Adafruit_DHT and WebsocketWrapper

(venv) pi@Pi4MQTTtoHA:~/venv $ python3 -m mqtt_io config.yml 2024-06-20 11:15:15 mqtt_io.server [INFO] Connecting to MQTT... 2024-06-20 11:15:15 mqtt_io.server [ERROR] Exception in critical task: Traceback (most recent call last): File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/server.py", line 1380, in _main_loop await self._connect_mqtt() File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/server.py", line 707, in _connect_mqtt await self.mqtt.connect() File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/mqtt/asyncio_mqtt.py", line 51, in inner await func(*args, **kwargs) File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/mqtt/asyncio_mqtt.py", line 116, in connect await self._client.connect(timeout=timeout) File "/home/pi/venv/lib/python3.11/site-packages/asyncio_mqtt/client.py", line 82, in connect if not isinstance(client_socket, mqtt.WebsocketWrapper): ^^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'paho.mqtt.client' has no attribute 'WebsocketWrapper' 2024-06-20 11:15:17 mqtt_io.server [INFO] Reconnecting to MQTT broker (infinite retries remaining) 2024-06-20 11:15:17 mqtt_io.server [INFO] Connecting to MQTT... 2024-06-20 11:15:17 mqtt_io.server [ERROR] Exception in critical task: Traceback (most recent call last): File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/server.py", line 1380, in _main_loop await self._connect_mqtt() File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/server.py", line 707, in _connect_mqtt await self.mqtt.connect() File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/mqtt/asyncio_mqtt.py", line 51, in inner await func(*args, **kwargs) File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/mqtt/asyncio_mqtt.py", line 116, in connect await self._client.connect(timeout=timeout) File "/home/pi/venv/lib/python3.11/site-packages/asyncio_mqtt/client.py", line 82, in connect if not isinstance(client_socket, mqtt.WebsocketWrapper): ^^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'paho.mqtt.client' has no attribute 'WebsocketWrapper' 2024-06-20 11:15:19 mqtt_io.server [INFO] Reconnecting to MQTT broker (infinite retries remaining) 2024-06-20 11:15:19 mqtt_io.server [INFO] Connecting to MQTT... 2024-06-20 11:15:19 mqtt_io.server [ERROR] Exception in critical task: Traceback (most recent call last): File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/server.py", line 1380, in _main_loop await self._connect_mqtt() File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/server.py", line 707, in _connect_mqtt await self.mqtt.connect() File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/mqtt/asyncio_mqtt.py", line 51, in inner await func(*args, **kwargs) File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/mqtt/asyncio_mqtt.py", line 116, in connect await self._client.connect(timeout=timeout) File "/home/pi/venv/lib/python3.11/site-packages/asyncio_mqtt/client.py", line 82, in connect if not isinstance(client_socket, mqtt.WebsocketWrapper): ^^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'paho.mqtt.client' has no attribute 'WebsocketWrapper' 2024-06-20 11:15:21 mqtt_io.server [INFO] Reconnecting to MQTT broker (infinite retries remaining) 2024-06-20 11:15:21 mqtt_io.server [INFO] Connecting to MQTT... 2024-06-20 11:15:21 mqtt_io.server [ERROR] Exception in critical task: Traceback (most recent call last): File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/server.py", line 1380, in _main_loop await self._connect_mqtt() File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/server.py", line 707, in _connect_mqtt await self.mqtt.connect() File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/mqtt/asyncio_mqtt.py", line 51, in inner await func(*args, **kwargs) File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/mqtt/asyncio_mqtt.py", line 116, in connect await self._client.connect(timeout=timeout) File "/home/pi/venv/lib/python3.11/site-packages/asyncio_mqtt/client.py", line 82, in connect if not isinstance(client_socket, mqtt.WebsocketWrapper): ^^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'paho.mqtt.client' has no attribute 'WebsocketWrapper' 2024-06-20 11:15:23 mqtt_io.server [INFO] Reconnecting to MQTT broker (infinite retries remaining) 2024-06-20 11:15:23 mqtt_io.server [INFO] Connecting to MQTT... 2024-06-20 11:15:23 mqtt_io.server [ERROR] Exception in critical task: Traceback (most recent call last): File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/server.py", line 1380, in _main_loop await self._connect_mqtt() File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/server.py", line 707, in _connect_mqtt await self.mqtt.connect() File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/mqtt/asyncio_mqtt.py", line 51, in inner await func(*args, **kwargs) File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/mqtt/asyncio_mqtt.py", line 116, in connect await self._client.connect(timeout=timeout) File "/home/pi/venv/lib/python3.11/site-packages/asyncio_mqtt/client.py", line 82, in connect if not isinstance(client_socket, mqtt.WebsocketWrapper): ^^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'paho.mqtt.client' has no attribute 'WebsocketWrapper' 2024-06-20 11:15:25 mqtt_io.server [ERROR] Exception when retrieving value from sensor 'temperature_solar': Traceback (most recent call last): File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/server.py", line 677, in poll_sensor value = await get_sensor_value() ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/backoff/_async.py", line 133, in retry ret = await target(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/backoff/_async.py", line 66, in retry ret = await target(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/server.py", line 672, in get_sensor_value return await sensor_module.async_get_value(sens_conf) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/modules/sensor/__init__.py", line 58, in async_get_value return await loop.run_in_executor(self.executor, self.get_value, sens_conf) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/modules/sensor/dht22.py", line 62, in get_value humidity, temperature = self.sensor.read_retry(self.sensor_type, self.pin) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/Adafruit_DHT/common.py", line 94, in read_retry humidity, temperature = read(sensor, pin, platform) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/Adafruit_DHT/common.py", line 80, in read platform = get_platform() ^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/Adafruit_DHT/common.py", line 63, in get_platform raise RuntimeError('Unknown platform.') RuntimeError: Unknown platform. 2024-06-20 11:15:25 mqtt_io.server [ERROR] Exception when retrieving value from sensor 'humidity_solar': Traceback (most recent call last): File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/server.py", line 677, in poll_sensor value = await get_sensor_value() ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/backoff/_async.py", line 133, in retry ret = await target(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/backoff/_async.py", line 66, in retry ret = await target(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/server.py", line 672, in get_sensor_value return await sensor_module.async_get_value(sens_conf) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/modules/sensor/__init__.py", line 58, in async_get_value return await loop.run_in_executor(self.executor, self.get_value, sens_conf) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/modules/sensor/dht22.py", line 62, in get_value humidity, temperature = self.sensor.read_retry(self.sensor_type, self.pin) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/Adafruit_DHT/common.py", line 94, in read_retry humidity, temperature = read(sensor, pin, platform) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/Adafruit_DHT/common.py", line 80, in read platform = get_platform() ^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/Adafruit_DHT/common.py", line 63, in get_platform raise RuntimeError('Unknown platform.') RuntimeError: Unknown platform. 2024-06-20 11:15:25 mqtt_io.server [ERROR] Exception when retrieving value from sensor 'temperature_zisterne': Traceback (most recent call last): File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/server.py", line 677, in poll_sensor value = await get_sensor_value() ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/backoff/_async.py", line 133, in retry ret = await target(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/backoff/_async.py", line 66, in retry ret = await target(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/server.py", line 672, in get_sensor_value return await sensor_module.async_get_value(sens_conf) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/modules/sensor/__init__.py", line 58, in async_get_value return await loop.run_in_executor(self.executor, self.get_value, sens_conf) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/modules/sensor/dht22.py", line 62, in get_value humidity, temperature = self.sensor.read_retry(self.sensor_type, self.pin) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/Adafruit_DHT/common.py", line 94, in read_retry humidity, temperature = read(sensor, pin, platform) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/Adafruit_DHT/common.py", line 80, in read platform = get_platform() ^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/Adafruit_DHT/common.py", line 63, in get_platform raise RuntimeError('Unknown platform.') RuntimeError: Unknown platform. 2024-06-20 11:15:25 mqtt_io.server [ERROR] Exception when retrieving value from sensor 'humidity': Traceback (most recent call last): File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/server.py", line 677, in poll_sensor value = await get_sensor_value() ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/backoff/_async.py", line 133, in retry ret = await target(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/backoff/_async.py", line 66, in retry ret = await target(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/server.py", line 672, in get_sensor_value return await sensor_module.async_get_value(sens_conf) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/modules/sensor/__init__.py", line 58, in async_get_value return await loop.run_in_executor(self.executor, self.get_value, sens_conf) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/mqtt_io/modules/sensor/dht22.py", line 62, in get_value humidity, temperature = self.sensor.read_retry(self.sensor_type, self.pin) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/Adafruit_DHT/common.py", line 94, in read_retry humidity, temperature = read(sensor, pin, platform) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/Adafruit_DHT/common.py", line 80, in read platform = get_platform() ^^^^^^^^^^^^^^ File "/home/pi/venv/lib/python3.11/site-packages/Adafruit_DHT/common.py", line 63, in get_platform raise RuntimeError('Unknown platform.') RuntimeError: Unknown platform.

@eMindFfM
Copy link
Author

eMindFfM commented Jun 20, 2024

The connection to the mqtt server seem to work
image

This is my config file
`mqtt:
host: HOSTNAME
topic_prefix: MQTTtoHA/Sensor/TempHum
port: 1883

sensor_modules:

  • name: dht22_sensor_solar
    module: dht22
    type: AM2302
    pin: 22
  • name: dht22_sensor_zisterne
    module: dht22
    type: AM2302
    pin: 32
    sensor_inputs:
  • name: temperature_solar
    module: dht22_sensor_solar
    interval: 10
    digits: 4
    type: temperature
  • name: humidity_solar
    module: dht22_sensor_solar
    interval: 10
    digits: 4
    type: humidity
  • name: temperature_zisterne
    module: dht22_sensor_zisterne
    interval: 10
    digits: 4
    type: temperature
  • name: humidity
    module: dht22_sensor_zisterne
    interval: 10
    digits: 4
    type: humidity`

@eMindFfM
Copy link
Author

Update ... The issue with the Websocket Wrapper can be soved by installing an old version of paho-mqtt

pip install paho-mqtt==1.6.1

@eMindFfM
Copy link
Author

The Issue with RuntimeError: Unknown platform. remains

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants