From d0b15a162ac3cec61118eb18b502ccbcfcfaf440 Mon Sep 17 00:00:00 2001 From: klaute Date: Fri, 27 Mar 2020 19:06:11 +0100 Subject: [PATCH] Example update --- oko-weather/oko-weather-sync.py | 4 ++-- oko-weather/oko_user_config.py_example | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/oko-weather/oko-weather-sync.py b/oko-weather/oko-weather-sync.py index 1cbccd0..3d0947b 100644 --- a/oko-weather/oko-weather-sync.py +++ b/oko-weather/oko-weather-sync.py @@ -13,7 +13,7 @@ from influxdb import InfluxDBClient from oko_user_config import * -oko_influxdb_query = "select last(temperature), humidity, light, windspeed, pressure from weather where device='" +oko_influxdb_query = "select temperature, humidity, light, windspeed, pressure from weather where device='%STATION%' order by time desc limit 1;" def read_data_from_influxdb(): # temp, hum, wind, pres, date @@ -21,7 +21,7 @@ def read_data_from_influxdb(): client = InfluxDBClient(oko_server, oko_server_port, oko_user, oko_password, oko_dbname) - query = oko_influxdb_query + oko_weatherstation_name + "';" + query = oko_influxdb_query.replace("%STATION%", oko_weatherstation_name) print(query) qres = client.query(query) diff --git a/oko-weather/oko_user_config.py_example b/oko-weather/oko_user_config.py_example index 976cdb7..32d0205 100644 --- a/oko-weather/oko_user_config.py_example +++ b/oko-weather/oko_user_config.py_example @@ -1,3 +1,5 @@ +# do not midify this file +# copy thos file to oko_user_config.py oko_server = "influxdb host" oko_server_port = "8082"