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

View File

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

View File

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