Example update
This commit is contained in:
parent
504b27a834
commit
d0b15a162a
2 changed files with 4 additions and 2 deletions
|
@ -13,7 +13,7 @@ from influxdb import InfluxDBClient
|
||||||
|
|
||||||
from oko_user_config import *
|
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():
|
def read_data_from_influxdb():
|
||||||
# temp, hum, wind, pres, date
|
# 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)
|
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)
|
print(query)
|
||||||
|
|
||||||
qres = client.query(query)
|
qres = client.query(query)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# do not midify this file
|
||||||
|
# copy thos file to oko_user_config.py
|
||||||
|
|
||||||
oko_server = "influxdb host"
|
oko_server = "influxdb host"
|
||||||
oko_server_port = "8082"
|
oko_server_port = "8082"
|
||||||
|
|
Loading…
Reference in a new issue