This commit is contained in:
xyj 2023-12-07 18:31:33 +08:00
parent 5f4b7fc91a
commit 0d3077ad02
1 changed files with 5 additions and 5 deletions

10
MQTT.py
View File

@ -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):
# # print("验证失败")
# return
# # print("验证通过")
# client.publish('error', payload='通过', qos=0)
try:
origin_data = json.loads(msg.payload.decode('utf-8'))
data = origin_data["msg"]