def connect(self):
print("Connecting to {host}:{port}...".format(**self.mqtt_config))
if 'ca_certs' in self.mqtt_config:
self.mqtt.tls_set(self.mqtt_config['ca_certs'], tls_version=ssl.PROTOCOL_TLSv1_2)
if 'user' in self.mqtt_config:
self.mqtt.username_pw_set(self.mqtt_config['user'], self.mqtt_config['password'])
self.mqtt.connect(self.mqtt_config['host'], self.mqtt_config['port'])
评论列表
文章目录