From 232a2955cc23d7321f0de11f1556f2b8914f313c Mon Sep 17 00:00:00 2001 From: xyj <10908227994@qq.com> Date: Sat, 9 Dec 2023 17:43:08 +0800 Subject: [PATCH] update --- MQTT.py | 8 +------- data_upload.py | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/MQTT.py b/MQTT.py index 4491986..831abe8 100755 --- a/MQTT.py +++ b/MQTT.py @@ -67,11 +67,6 @@ def on_message(client, userdata, msg): times = 120 - -def exec_shutdown(): - pass - - client = mqtt.Client(client_id=device_name) client.username_pw_set("demo", "123456") # Specify callback function @@ -81,9 +76,8 @@ while True: try: # ceshi-mqtt.lihaink.cn client.connect('192.168.1.27', 1883) - client.loop_forever() + client.loop_start() except Exception as e: print("Connection failed:", e) time.sleep(10) print("正在尝试重连") - diff --git a/data_upload.py b/data_upload.py index 71b421b..eecbd23 100755 --- a/data_upload.py +++ b/data_upload.py @@ -32,7 +32,7 @@ while True: try: # ceshi-mqtt.lihaink.cn client.connect('192.168.1.27', 1883) - client.loop_forever() + client.loop_start() except Exception as e: print("Connection failed:", e) if times == 0: