diff options
author | dennis <d@ennis.no> | 2023-02-06 20:27:30 +0100 |
---|---|---|
committer | dennis <d@ennis.no> | 2023-02-06 20:27:30 +0100 |
commit | b1eab0da8b09397785692b1b0387e5157ad3d663 (patch) | |
tree | 2a4bcda4e38e57d06827484736e38ca431e3d36a /scripts/mqtt_watch.py | |
parent | remove extra whitespace (diff) | |
download | energyscripts-b1eab0da8b09397785692b1b0387e5157ad3d663.tar.gz |
insert more temperatures
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)" |