This commit is contained in:
xyj 2023-12-07 18:41:50 +08:00
parent 25ba5058f7
commit 7a39502fe5
1 changed files with 2 additions and 1 deletions

View File

@ -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("验证通过")