mqtt CallbackAPIVersion fix for paho.mqtt >= 2.0.0

fix to work with paho.mqtt >= 2.0.0
This commit is contained in:
revil-O 2024-04-08 16:05:27 +02:00
parent dba0acb82e
commit 584f226b62

View file

@ -37,7 +37,7 @@ class MqttClient(mqtt.Client, threading.Thread):
**kwargs, **kwargs,
): ):
self.client_id = client_id or str(Config.get('device_id')) self.client_id = client_id or str(Config.get('device_id'))
mqtt.Client.__init__(self, *args, client_id=self.client_id, **kwargs) mqtt.Client.__init__(self, mqtt.CallbackAPIVersion.VERSION1, *args, client_id=self.client_id, **kwargs)
threading.Thread.__init__(self, name=f'MQTTClient:{self.client_id}') threading.Thread.__init__(self, name=f'MQTTClient:{self.client_id}')
self.logger = logging.getLogger(self.__class__.__name__) self.logger = logging.getLogger(self.__class__.__name__)