update
This commit is contained in:
parent
bee6cae883
commit
25ba5058f7
11
MQTT.py
11
MQTT.py
|
@ -30,11 +30,11 @@ def valid(msg, client):
|
|||
|
||||
# Message receiving callback
|
||||
def on_message(client, userdata, msg):
|
||||
# if not valid(msg, client):
|
||||
# # print("验证失败")
|
||||
# return
|
||||
# # print("验证通过")
|
||||
# client.publish('error', payload='通过', qos=0)
|
||||
if not valid(msg, client):
|
||||
client.publish('error', payload='验证失败', qos=0)
|
||||
return
|
||||
# print("验证通过")
|
||||
client.publish('success', payload='验证通过', qos=0)
|
||||
try:
|
||||
origin_data = json.loads(msg.payload.decode('utf-8'))
|
||||
data = origin_data["msg"]
|
||||
|
@ -59,7 +59,6 @@ def on_message(client, userdata, msg):
|
|||
elif data == "status":
|
||||
# 查看运行状态
|
||||
get_status(client)
|
||||
client.publish('error', payload='No Such Type2', qos=0)
|
||||
else:
|
||||
# 错误类型
|
||||
client.publish('error', payload='No Such Type', qos=0)
|
||||
|
|
Loading…
Reference in New Issue