You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
While working on improvements to Insteon-MQTT, I noticed that if the latest paho-mqtt version (2.0) is used, I get the following error:
According to this document, paho-mqtt changed several parts of its API. The old API from paho-mqtt is still available by passing callback_api_version=CallbackAPIVersion.VERSION1, though the V1 API is marked deprecated.
To Reproduce
Steps to reproduce the behavior:
Set up a development environment as described here.
Run pytest tests/test_Integration.py or insteon-mqtt ~/config.yaml start
Expected behavior
Test should pass / insteon-mqtt should start without throwing TypeError exception
Log Output
Please change your logging level to 10 by editing Logging.level in your config.yaml file.
# Put your relevant logging output below this line
Exception ignored in: <function Client.__del__ at 0x7fb4374c8540>
Traceback (most recent call last):
File "/home/ironman/venv/lib/python3.11/site-packages/paho/mqtt/client.py", line 874, in __del__
self._reset_sockets()
File "/home/ironman/venv/lib/python3.11/site-packages/paho/mqtt/client.py", line 1133, in _reset_sockets
self._sock_close()
File "/home/ironman/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'
Traceback (most recent call last):
File "/home/ironman/venv/bin/insteon-mqtt", line 5, in <module>
status = insteon_mqtt.cmd_line.main()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ironman/venv/lib/python3.11/site-packages/insteon_mqtt/cmd_line/main.py", line 587, in main
return args.func(args, cfg)
^^^^^^^^^^^^^^^^^^^^
File "/home/ironman/venv/lib/python3.11/site-packages/insteon_mqtt/cmd_line/start.py", line 34, in start
mqtt_link = network.Mqtt()
^^^^^^^^^^^^^^
File "/home/ironman/venv/lib/python3.11/site-packages/insteon_mqtt/network/Mqtt.py", line 101, in __init__
self.setup_client()
File "/home/ironman/venv/lib/python3.11/site-packages/insteon_mqtt/network/Mqtt.py", line 111, in setup_client
self.client = paho.Client(**client_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Client.__init__() missing 1 required positional argument: 'callback_api_version'
Your Configuration
What are the relevant entries in your config.yaml? Please include the device definition of the device affected.
As of Paho version 2.1.0, the missing 1 required positional argument: 'callback_api_version' error is now replaced with a DeprecationWarning: Callback API version 1 is deprecated, update to latest version warning, due to changes in PR eclipse-paho/paho.mqtt.python#831.
There may still be some value in updating to the version 2 API, though, even if only to resolve the DeprecationWarning: Callback API version 1 is deprecated, update to latest version warning that shows when running against Paho >= 2.1.0.
Updating title to reflect new symptoms with current Paho code.
tstabrawa
changed the title
Using paho-mqtt 2.0 yields TypeError: Client.__init__() missing 1 required positional argument: 'callback_api_version'
Using paho-mqtt 2.1 yields DeprecationWarning: Callback API version 1 is deprecated, update to latest versionNov 10, 2024
Describe the bug
While working on improvements to Insteon-MQTT, I noticed that if the latest paho-mqtt version (2.0) is used, I get the following error:
TypeError: Client.__init__() missing 1 required positional argument: 'callback_api_version'
According to this document, paho-mqtt changed several parts of its API. The old API from paho-mqtt is still available by passing callback_api_version=CallbackAPIVersion.VERSION1, though the V1 API is marked deprecated.
To Reproduce
Steps to reproduce the behavior:
pytest tests/test_Integration.py
orinsteon-mqtt ~/config.yaml start
Expected behavior
Test should pass / insteon-mqtt should start without throwing TypeError exception
Log Output
Please change your logging level to 10 by editing Logging.level in your config.yaml file.
Your Configuration
What are the relevant entries in your config.yaml? Please include the device definition of the device affected.
N/A
Hardware Details
Debian Bookworm
# Please paste the output of get-model for the modem below this line NETWORK_BRIDGES (0x03): '2448A7' (0x20) 'USB Adapter'
# Please paste the output of get-model for the affected device below this line N/A
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: