gavinying / modpoll

A New Command-line Tool for Modbus and MQTT
https://gavinying.github.io/modpoll
MIT License
84 stars 17 forks source link

breaking change in paho.mqtt.python #39

Closed mitchell-pioneer closed 3 months ago

mitchell-pioneer commented 4 months ago

I beleve there is a breaking change in paho.mqtt for version 2

from there doc

Add version to user callbacks (on_publish, on_connect…). tl; dr: add mqtt.CallbackAPIVersion.VERSION1 as first argument to [Client()]

https://eclipse.dev/paho/files/paho.mqtt.python/html/migrations.html

change

        mqttc = mqtt.Client(
            clientid,
            clean_session=(args.mqtt_qos == 0),
            userdata={"qos": args.mqtt_qos},
         )

to

        mqttc = mqtt.Client(
            mqtt.CallbackAPIVersion.VERSION1,
            clientid,
            clean_session=(args.mqtt_qos == 0),
            userdata={"qos": args.mqtt_qos},
         )
gavinying commented 3 months ago

Hi @mitchell-pioneer , noted the breaking changes on paho v2, thanks. Currently, I am doing a major refactoring on master branch, will tackle this issue later for sure. Stay tuned.