This commit is contained in:
xyj 2023-12-11 15:11:22 +08:00
parent be32fda966
commit 46160694af
2 changed files with 3 additions and 3 deletions

View File

@ -34,8 +34,8 @@ class MQTTClient:
self.topic = topic self.topic = topic
self.username = username self.username = username
self.password = password self.password = password
self.client = mqtt.Client(client_id=device_name) self.client = mqtt.Client()
self.client.username_pw_set(self.username, self.password) # self.client.username_pw_set(self.username, self.password)
self.client.on_connect = self.on_connect self.client.on_connect = self.on_connect
self.client.on_message = self.on_message self.client.on_message = self.on_message

View File

@ -18,7 +18,7 @@ class DataUploadClient:
self.topic = topic self.topic = topic
self.username = username self.username = username
self.password = password self.password = password
self.client = mqtt.Client(client_id=device_name) self.client = mqtt.Client()
self.client.username_pw_set(self.username, self.password) self.client.username_pw_set(self.username, self.password)
self.client.on_connect = self.on_connect self.client.on_connect = self.on_connect
self.client.on_disconnect = self.on_disconnect self.client.on_disconnect = self.on_disconnect