paho-mqtt and weewx-mqtt: paho-mqtt-2.0.0 not compatible!

175 views
Skip to first unread message

michael.k...@gmx.at

unread,
Feb 11, 2024, 3:12:13 AM2/11/24
to weewx-user
WeeWX won't crash, but MQTT won't work: when using weewx-mqtt with paho-mqtt-2.0.0, it fails with:

Exception ignored in: <function Client.__del__ at 0x73bc6028>
Traceback (most recent call last):
  File "/home/michi/weewx-venv/lib/python3.11/site-packages/paho/mqtt/client.py", line 874, in __del__
    self._reset_sockets()
  File "/home/michi/weewx-venv/lib/python3.11/site-packages/paho/mqtt/client.py", line 1133, in _reset_sockets
    self._sock_close()
  File "/home/michi/weewx-venv/lib/python3.11/site-packages/paho/mqtt/client.py", line 1119, in _sock_close
    if not self._sock:
           ^^^^^^^^^^
AttributeError: 'Client' object has no attribute '_sock'
Exception in thread MQTT:
Traceback (most recent call last):
  File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/home/michi/weewx-venv/lib/python3.11/site-packages/weewx/restx.py", line 357, in run
    self.run_loop(_manager)
  File "/home/michi/weewx-venv/lib/python3.11/site-packages/weewx/restx.py", line 384, in run_loop
    self.process_record(_record, dbmanager)
  File "/home/michi/weewx-data/bin/user/mqtt.py", line 522, in process_record
    self.get_mqtt_client()
  File "/home/michi/weewx-data/bin/user/mqtt.py", line 444, in get_mqtt_client
    mc = mqtt.Client(client_id=client_id)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Client.__init__() missing 1 required positional argument: 'callback_api_version'


With pip, install paho-mqtt-1.6.1 as a workaround:

pip install paho-mqtt==1.6.1
Reply all
Reply to author
Forward
0 new messages