Skip to content

Comments

Migrate Paho MQTT client to Callback API version 2#10

Open
rgrizzell wants to merge 2 commits intogeoffwhittington:mainfrom
rgrizzell:main
Open

Migrate Paho MQTT client to Callback API version 2#10
rgrizzell wants to merge 2 commits intogeoffwhittington:mainfrom
rgrizzell:main

Conversation

@rgrizzell
Copy link

@rgrizzell rgrizzell commented Feb 22, 2025

paho-mqtt recently updated their Callback API to version 2. Using their provided migration guide, this pull request addresses some issues with newer installations of meshtastic-bridge.

  • Resolves the deprecation warning on start-up
    /home/rgrizzell/meshtastic-bridge/main.py:129: DeprecationWarning: Callback API version 1 is deprecated, update to the latest version
      mqttc = mqtt.Client()
    
  • Fixes an issue where the MQTT client fails to start when a client_id is specified in config.yaml.
    Traceback (most recent call last):
      File "/home/rgrizzell/meshtastic-bridge/main.py", line 127, in <module>
        mqttc = mqtt.Client(client_id)
      File "/home/rgrizzell/meshtastic-bridge/lib64/python3.10/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
    
  • Improves error handling around MQTT Auth and ACL issues.
    ERROR:meshtastic.bridge:Could not connect to MQTT local [Not authorized]
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant