From 57fb9b9ea6ac96445d0498eac072477b21183ba1 Mon Sep 17 00:00:00 2001 From: xyj <10908227994@qq.com> Date: Thu, 7 Dec 2023 18:43:18 +0800 Subject: [PATCH] update --- MQTT.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MQTT.py b/MQTT.py index 6168895..e333e58 100644 --- a/MQTT.py +++ b/MQTT.py @@ -5,9 +5,7 @@ import paho.mqtt.client as mqtt from tool import push_stream, close_stream, update, exec_sh, get_record, get_list_record, get_status -import os -device_name = os.getenv('device_name') def on_connect(client, userdata, flags, rc): @@ -16,6 +14,8 @@ def on_connect(client, userdata, flags, rc): def valid(msg, client): + import os + device_name = os.getenv('device_name') origin_data = json.loads(msg.payload.decode('utf-8')) if 'msg' not in origin_data: client.publish('error', payload='msg must be supplied', qos=0)