Description
Question
On a reconnect, on_reconnect calls my reconnect function where I reinitialise the connection calling the reinitialise method of the client
mqttc.reinitialise(mqtt_clientID, clean_session=False, userdata=None)
However, this triggers an error
File "/usr/local/lib/python3.11/dist-packages/paho/mqtt/client.py", line 1156, in reinitialise
self.__init__(client_id, clean_session, userdata) # type: ignore[misc]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/paho/mqtt/client.py", line 772, in __init__
raise ValueError(
ValueError: Unsupported callback API version: version 2.0 added a callback_api_version, see docs/migrations.rst for details
Searching online for information I do find the migration information but nothing is mentioned about this method. Looking for the method, I only find info in the documentation indicating I do the right thing. (cfr: https://eclipse.dev/paho/files/paho.mqtt.python/html/client.html)
I even tried this
mqttc.reinitialise(mqtt.CallbackAPIVersion.VERSION2, mqtt_clientID, clean_session=False, userdata=None)
but that triggers an error saying clean_session is mentioned twice.
What is wrong here? Where can I find information on the V2 reinitialise method?
Environment
- Python version: 3.11.2
- Library version: 2.1.0
- Operating system: Debian Bookworm 12
- MQTT server: mosquitto 2.0.18 on Windows