diff options
Diffstat (limited to 'scripts/mqtt_watch.py')
-rw-r--r-- | scripts/mqtt_watch.py | 3 |
1 files changed, 2 insertions, 1 deletions
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)" |