This commit is contained in:
xyj 2023-12-07 18:43:18 +08:00
parent 7a39502fe5
commit 57fb9b9ea6
1 changed files with 2 additions and 2 deletions

View File

@ -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 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): def on_connect(client, userdata, flags, rc):
@ -16,6 +14,8 @@ def on_connect(client, userdata, flags, rc):
def valid(msg, client): def valid(msg, client):
import os
device_name = os.getenv('device_name')
origin_data = json.loads(msg.payload.decode('utf-8')) origin_data = json.loads(msg.payload.decode('utf-8'))
if 'msg' not in origin_data: if 'msg' not in origin_data:
client.publish('error', payload='msg must be supplied', qos=0) client.publish('error', payload='msg must be supplied', qos=0)