From 44eb888d51af811ef5616837e327e084154c0e79 Mon Sep 17 00:00:00 2001 From: xyj <10908227994@qq.com> Date: Thu, 7 Dec 2023 18:54:45 +0800 Subject: [PATCH] update --- MQTT.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MQTT.py b/MQTT.py index 29ddd8e..c943430 100644 --- a/MQTT.py +++ b/MQTT.py @@ -30,7 +30,7 @@ def on_message(client, userdata, msg): # print("验证通过") import os # device_name = os.environ['device_name'] - # client.publish('error', payload=device_name, qos=0) + client.publish('error', payload=device_name, qos=0) # client.publish('success', payload='验证通过', qos=0) try: origin_data = json.loads(msg.payload.decode('utf-8')) @@ -69,8 +69,9 @@ times = 120 def exec_shutdown(): pass - +import os if __name__ == '__main__': + device_name = os.environ.get('device_name') while True: try: client = mqtt.Client(client_id='s')