update script

This commit is contained in:
Joerg Lehmann 2024-07-23 19:42:24 +02:00
parent 32b394b496
commit 2366aa7214
1 changed files with 2 additions and 2 deletions

View File

@ -40,7 +40,7 @@ def write2file(msg):
def on_message(client, userdata, msg):
"""The callback for when a PUBLISH message is received from the server."""
#print(msg.topic + ' ' + str(msg.payload))
print(msg.topic + ' ' + str(msg.payload))
result = _parse_mqtt_message(msg.topic, msg.payload.decode('utf-8'))
if result is None:
print("Couldn't parse sensor data!")
@ -51,7 +51,7 @@ def on_message(client, userdata, msg):
return
def main():
mqtt_client = mqtt.Client(MQTT_CLIENT_ID)
mqtt_client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION1,MQTT_CLIENT_ID)
mqtt_client.username_pw_set(MQTT_USER, MQTT_PASSWORD)
mqtt_client.on_connect = on_connect
mqtt_client.on_message = on_message