Actualiser mqtt-python.py

This commit is contained in:
nicolas.schmauch 2024-06-25 14:16:39 +02:00
parent 37ef459625
commit 2f6da4ea09

View file

@ -40,7 +40,7 @@ def log(time):
f.close() f.close()
def dump_log(text): def dump_log(text):
f = open("/var/log/mqtt-influxdb/dumped_message_thermo-bibli_test", "a") f = open("/var/log/mqtt-influxdb/dumped_message_thermo-fablab", "a")
f.write(text + "\n") f.write(text + "\n")
f.close() f.close()
@ -66,7 +66,7 @@ def on_connect(client, userdata, flags, rc):
def on_message(client, userdata, message): def on_message(client, userdata, message):
message = (message.payload).decode("utf-8") # convertit type bytes en string message = (message.payload).decode("utf-8") # convertit type bytes en string
print("Message reçu") print("\nMessage reçu")
tab = message.split("|") tab = message.split("|")
temp = tab[2].split() temp = tab[2].split()
hum = tab[3].split() hum = tab[3].split()