From b1eab0da8b09397785692b1b0387e5157ad3d663 Mon Sep 17 00:00:00 2001 From: dennis Date: Mon, 6 Feb 2023 20:27:30 +0100 Subject: insert more temperatures --- scripts/mqtt_watch.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts/mqtt_watch.py') diff --git a/scripts/mqtt_watch.py b/scripts/mqtt_watch.py index 775b84a..371debd 100644 --- a/scripts/mqtt_watch.py +++ b/scripts/mqtt_watch.py @@ -2,6 +2,7 @@ ''' Listen for mqtt-events, and trigger for some ''' import os +from datetime import datetime import paho.mqtt.client as mqtt import common @@ -22,7 +23,7 @@ def on_connect(client, userdata, flags, rc): # The callback for when a PUBLISH message is received from the server. def on_message(client, userdata, msg): - print(msg.topic, msg.payload) + print(msg.topic, datetime.utcnow(), msg.payload) #if name.startswith('tmp') and 'temperature' in data and 'humidity' in data: # sql = "INSERT INTO mqtt_temps (name, temperature, humidity, battery, linkquality, voltage, time) VALUES(%s,%s,%s,%s,%s,%s,%s)" -- cgit v1.2.3