This commit is contained in:
xyj 2023-12-09 17:36:30 +08:00
parent 95bca848c9
commit d9db4ee8bd
2 changed files with 34 additions and 36 deletions

View File

@ -71,7 +71,6 @@ def exec_shutdown():
pass
if __name__ == '__main__':
client = mqtt.Client(client_id=device_name)
client.username_pw_set("demo", "123456")
# Specify callback function

View File

@ -19,15 +19,14 @@ def on_disconnect(client, userdata, rc):
print("失败,执行本地存储")
# subprocess.Popen(['/usr/bin/bash /home/pi/lot_manager/bash/stop_data_upload.sh'], shell=True)
times = 3
if __name__ == '__main__':
client = mqtt.Client(client_id=device_name)
client.username_pw_set("demo", "123456")
# Specify callback function
client.on_connect = on_connect
client.on_disconnect = on_disconnect
# 尝试连接 MQTT 服务器
while True:
try: