msg MQTT message

main
zart 5 months ago
parent 20e0d57df5
commit c2345c82e1

@ -16,8 +16,8 @@ def on_connect(client, userdata, flags, rc, properties=None):
def on_message(client, userdata, msg):
print("收到消息: " + msg.topic + " " + str(msg.payload))
if not os.path.exists("user.txt"):
with open("user.txt", "a") as f:
if not os.path.exists("smp_coder/user.txt"):
with open("smp_coder/user.txt", "a") as f:
f.write(msg.payload.decode("utf-8") + "\n")
else:

Loading…
Cancel
Save