Open openstep opened 3 months ago
Hi have the same issue, same system and the following configuration:
mqtt:
host: 192.168.xx
port: 1883
topic_prefix: mqtt_io
ha_discovery:
enabled: yes
sensor_modules:
- name: dht22_sensor
module: dht22
type: DHT22
pin: 2
sensor_inputs:
- name: temperature
module: dht22_sensor
interval: 10
digits: 4
type: temperature
- name: humidity
module: dht22_sensor
interval: 10
digits: 4
type: humidity
This looks like #348 - downgrading paho-mqtt
to the latest 1.x version should solve it.
how do you do that?
how do you do that?
If you installed it using pip, then you can downgrade with pip install 'paho-mqtt<2'
, which will get you the latest 1.x version.
Downgrading paho-mqtt
did the trick for me. But I had to upgrade my ancient OS to Raspbian 11 first.
will be fixed with PR: #364
Describe the bug When starting with the config below, there is an error that prevents the mqtt-io from working
Expected behavior A working code
Error messages and traceback ERROR:
python3 -m mqtt_io config.yml 2024-03-22 19:07:15 mqtt_io.server [INFO] Digital output 'rele1' current value is False (raw: False) 2024-03-22 19:07:15 mqtt_io.server [INFO] Digital output 'rele2' current value is False (raw: False) 2024-03-22 19:07:16 mqtt_io.server [INFO] Digital output 'rele3' current value is False (raw: False) 2024-03-22 19:07:17 mqtt_io.server [INFO] Digital output 'rele4' current value is False (raw: False) 2024-03-22 19:07:17 mqtt_io.server [INFO] Digital output 'rele5' current value is False (raw: False) 2024-03-22 19:07:18 mqtt_io.server [INFO] Digital output 'rele6' current value is False (raw: False) 2024-03-22 19:07:19 mqtt_io.server [INFO] Digital output 'rele7' current value is False (raw: False) 2024-03-22 19:07:20 mqtt_io.server [INFO] Digital output 'rele8' current value is False (raw: False) Exception ignored in: <function Client.__del__ at 0x75d3b198> Traceback (most recent call last): File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 874, in __del__ self._reset_sockets() File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 1133, in _reset_sockets self._sock_close() File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 1119, in _sock_close if not self._sock: AttributeError: 'Client' object has no attribute '_sock' 2024-03-22 19:07:20 mqtt_io.server [ERROR] Exception in critical task: Traceback (most recent call last): File "/home/pi/.local/lib/python3.7/site-packages/mqtt_io/server.py", line 1380, in _main_loop await self._connect_mqtt() File "/home/pi/.local/lib/python3.7/site-packages/mqtt_io/server.py", line 703, in _connect_mqtt self.mqtt_client_options File "/home/pi/.local/lib/python3.7/site-packages/mqtt_io/mqtt/asyncio_mqtt.py", line 101, in __init__ clean_session=options.clean_session, File "/home/pi/.local/lib/python3.7/site-packages/asyncio_mqtt/client.py", line 34, in __init__ self._client = mqtt.Client(client_id=client_id, protocol=protocol, clean_session=clean_session, transport=transport) TypeError: __init__() missing 1 required positional argument: 'callback_api_version' 2024-03-22 19:07:22 mqtt_io.server [INFO] Reconnecting to MQTT broker (infinite retries remaining)
Config
Hardware Raspberry pi 3b+ and the mqtt server is on another host
System: