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:
|
if 'device_name' not in origin_data:
|
||||||
client.publish('error', payload='device_name must be supplied', qos=0)
|
client.publish('error', payload='device_name must be supplied', qos=0)
|
||||||
return False
|
return False
|
||||||
|
client.publish('error', payload=device_name, qos=0)
|
||||||
if origin_data['device_name'] != device_name:
|
if origin_data['device_name'] != device_name:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
@ -30,7 +31,7 @@ def valid(msg, client):
|
||||||
|
|
||||||
# Message receiving callback
|
# Message receiving callback
|
||||||
def on_message(client, userdata, msg):
|
def on_message(client, userdata, msg):
|
||||||
if not valid(msg, client):
|
if valid(msg, client) is False:
|
||||||
client.publish('error', payload='验证失败', qos=0)
|
client.publish('error', payload='验证失败', qos=0)
|
||||||
return
|
return
|
||||||
# print("验证通过")
|
# print("验证通过")
|
||||||
|
|
Loading…
Reference in New Issue