Skip to content

Commit

Permalink
Fix paho-mqtt new versions
Browse files Browse the repository at this point in the history
  • Loading branch information
bkbilly authored Mar 30, 2024
1 parent 5f7beed commit 8f6d24b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion alarmcode/notifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ def setupMQTT(self):

# self.mqttclient = mqtt.Client("", True, None, mqtt.MQTTv311)
if not hasattr(self, 'mqttclient'):
self.mqttclient = mqtt.Client(client_id=str(random.randint(1,10000)), clean_session=False)
if hasattr(mqtt, "CallbackAPIVersion"):
self.mqttclient = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
else:
self.mqttclient = mqtt.Client(client_id=str(random.randint(1,10000)), clean_session=False)

self.mqttclient.disconnect()
self.mqttclient.loop_stop(force=False)
Expand Down

0 comments on commit 8f6d24b

Please sign in to comment.