This commit is contained in:
xyj 2023-12-13 12:54:25 +08:00
parent fc4b470dfe
commit 96e8506c66
3 changed files with 14 additions and 17 deletions

View File

@ -75,7 +75,7 @@ class MQTTClient:
if __name__ == '__main__':
print(broker, port, subscribe_topic, publish_topic, username, password)
# print(broker, port, subscribe_topic, publish_topic, username, password)
# MQTT客户端
MQTT = MQTTClient(broker, port, subscribe_topic, username, password)
# 循环连接
@ -85,6 +85,6 @@ if __name__ == '__main__':
# 阻塞监听
MQTT.client.loop_forever()
except Exception as e:
print(e)
# print(e)
# 异常等待时间在进行连接
time.sleep(30)

View File

@ -4,8 +4,8 @@
# 订阅的控制主题,必须和系统设置的相同
subscribe_topic=lihai_lot_walnutpi_dev_1
# 发布消息的主题
publish_topic=device1
username=demo
publish_topic=camera_1
username=lihai_lot_land_1
password=123456
####################################
# 设备2-32G
@ -13,7 +13,7 @@ password=123456
# 订阅的控制主题,必须和系统设置的相同
subscribe_topic=lihai_lot_walnutpi_dev_2
# 发布消息的主题
publish_topic=device2
publish_topic=camera_2
username=demo
password=123456
####################################
@ -22,8 +22,8 @@ password=123456
# 订阅的控制主题,必须和系统设置的相同
subscribe_topic=lihai_lot_walnutpi_dev_3
# 发布消息的主题
publish_topic=device3
username=demo
publish_topic=camera_3
username=lihai_lot_land_1
password=123456
####################################
# 设备4-64G
@ -31,8 +31,8 @@ password=123456
# 订阅的控制主题,必须和系统设置的相同
subscribe_topic=lihai_lot_walnutpi_dev_4
# 发布消息的主题
publish_topic=device4
username=demo
publish_topic=camera_4
username=lihai_lot_land_1
password=123456
####################################
# 设备5-64G
@ -40,8 +40,8 @@ password=123456
# 订阅的控制主题,必须和系统设置的相同
subscribe_topic=lihai_lot_walnutpi_dev_5
# 发布消息的主题
publish_topic=device5
username=demo
publish_topic=camera_5
username=lihai_lot_land_1
password=123456
####################################
# 设备6-64G
@ -49,6 +49,6 @@ password=123456
# 订阅的控制主题,必须和系统设置的相同
subscribe_topic=lihai_lot_walnutpi_dev_6
# 发布消息的主题
publish_topic=device6
username=demo
publish_topic=camera_6
username=lihai_lot_land_1
password=123456

View File

@ -4,7 +4,4 @@ host=ceshi-mqtt.lihaink.cn
port=1883
[record]
post_record_list_url=https://shop.lihaink.cn/api/index/file_list
post_record_url=https://shop.lihaink.cn/api/index/upload
#[message_type]
post_record_url=https://shop.lihaink.cn/api/index/upload