Browse Source

Example update

klaute 8 months ago
parent
commit
d0b15a162a
2 changed files with 4 additions and 2 deletions
  1. 2
    2
      oko-weather/oko-weather-sync.py
  2. 2
    0
      oko-weather/oko_user_config.py_example

+ 2
- 2
oko-weather/oko-weather-sync.py View File

@@ -13,7 +13,7 @@ from influxdb import InfluxDBClient
13 13
 
14 14
 from oko_user_config import *
15 15
 
16
-oko_influxdb_query = "select last(temperature), humidity, light, windspeed, pressure from weather where device='"
16
+oko_influxdb_query = "select temperature, humidity, light, windspeed, pressure from weather where device='%STATION%' order by time desc limit 1;"
17 17
 
18 18
 def read_data_from_influxdb():
19 19
     # temp, hum, wind, pres, date
@@ -21,7 +21,7 @@ def read_data_from_influxdb():
21 21
 
22 22
     client = InfluxDBClient(oko_server, oko_server_port, oko_user, oko_password, oko_dbname)
23 23
 
24
-    query = oko_influxdb_query + oko_weatherstation_name + "';"
24
+    query = oko_influxdb_query.replace("%STATION%", oko_weatherstation_name)
25 25
     print(query)
26 26
 
27 27
     qres = client.query(query)

+ 2
- 0
oko-weather/oko_user_config.py_example View File

@@ -1,3 +1,5 @@
1
+# do not midify this file
2
+# copy thos file to oko_user_config.py
1 3
 
2 4
 oko_server = "influxdb host"
3 5
 oko_server_port  = "8082"

Loading…
Cancel
Save