From 7a39502fe5e7972d25a953282192ed0bb4fe3d61 Mon Sep 17 00:00:00 2001 From: xyj <10908227994@qq.com> Date: Thu, 7 Dec 2023 18:41:50 +0800 Subject: [PATCH] update --- MQTT.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MQTT.py b/MQTT.py index 313196d..6168895 100644 --- a/MQTT.py +++ b/MQTT.py @@ -23,6 +23,7 @@ def valid(msg, client): if 'device_name' not in origin_data: client.publish('error', payload='device_name must be supplied', qos=0) return False + client.publish('error', payload=device_name, qos=0) if origin_data['device_name'] != device_name: return False return True @@ -30,7 +31,7 @@ def valid(msg, client): # Message receiving callback def on_message(client, userdata, msg): - if not valid(msg, client): + if valid(msg, client) is False: client.publish('error', payload='验证失败', qos=0) return # print("验证通过")