eschava / broadlink-mqtt

MQTT client to control BroadLink devices
MIT License
221 stars 60 forks source link

fixing an issue with the breaking changes from the paho library >= 2 #117

Closed nboeckmann closed 2 months ago

nboeckmann commented 3 months ago

With Release 2.0 of the paho library there were breaking changes introduced - this PR adresses them and makes the client work with paho releases >=2

[2024-05-19 05:18:08,457] DEBUG Connected to 'RMMINIB' Broadlink device at '192.168.106.13' (MAC <redacted>) and started listening to MQTT commands at 'broadlink/#'
Traceback (most recent call last):
  File "/software/broadlink-mqtt/mqtt.py", line 600, in <module>
    mqttc = paho.Client(clientid, clean_session=cf.get('mqtt_clean_session', False), userdata=devices)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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
root@bitsas16:/software/broadlink-mqtt# python3 mqtt.py
[2024-05-19 05:20:04,508] DEBUG Connected to 'RMMINIB' Broadlink device at '192.168.106.13' (MAC e8:70:72:04:ee:11) and started listening to MQTT commands at 'broadlink/#'
Traceback (most recent call last):
  File "/software/broadlink-mqtt/mqtt.py", line 600, in <module>
    mqttc = paho.Client(clientid, clean_session=cf.get('mqtt_clean_session', False), userdata=devices)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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
eschava commented 2 months ago

@nboeckmann Thank you!