stevecope / mqtt-data-logger

Logs MQTT Data to a file
MIT License
28 stars 21 forks source link

paho-mqtt v2.x causing the code to fail #9

Open megusd opened 5 months ago

megusd commented 5 months ago

Tried to run the logger on freshly installed Python with freshly installed paho-mqtt module:

PS C:\Users\IMDEX\PyApps\mLog> python.exe mqtt-data-logger.py -b 127.0.0.1 -t tasmota/discovery/(purged)/sensors/# Python version is sys.version_info(major=3, minor=12, micro=4, releaselevel='final', serial=0) Log Directory = mlogs Log records per log = 5000 Max logs = Unlimited initialising clients Traceback (most recent call last): File "C:\Users\IMDEX\PyApps\mLog\mqtt-data-logger.py", line 201, in <module> client=Initialise_clients(cname,mqttclient_log,False)#create and initialise client object ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\IMDEX\PyApps\mLog\mqtt-data-logger.py", line 71, in Initialise_clients client= MQTTClient(cname,clean_session=cleansession) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\IMDEX\PyApps\mLog\mqtt-data-logger.py", line 41, in __init__ super(MQTTClient, self).__init__(cname,**kwargs) File "C:\Users\IMDEX\AppData\Local\Programs\Python\Python312\Lib\site-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 closing log file.

Found the problem described here

Downgrading paho-mqtt to latest available v1.* helped. pip uninstall paho-mqtt pip install "paho-mqtt<2.0.0"