update
This commit is contained in:
parent
25ba5058f7
commit
7a39502fe5
3
MQTT.py
3
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("验证通过")
|
||||
|
|
Loading…
Reference in New Issue