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