From 32e804731a0eecb191c6dfd736179fba9180ded1 Mon Sep 17 00:00:00 2001 From: ademant Date: Mon, 19 Aug 2019 17:18:39 +0200 Subject: [PATCH] adjust temperature page --- pyweb.py | 17 ++--------------- temperature.tpl | 2 ++ 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/pyweb.py b/pyweb.py index 035aec2..ae88b97 100755 --- a/pyweb.py +++ b/pyweb.py @@ -214,22 +214,11 @@ def show_solar(): def show_temperature(): mydb=pymysql.connect(read_default_file="~/.my.cnf",database="rasolar") myc=mydb.cursor() - myc.execute("select ids.id,ids.device,ids.varname from ids where ids.sensor in ('BME280','TSL2591','VEML6070')") - ti=myc.fetchall() - myids="(" - myvars={} - mydev={} - for ids,device,varname in ti: - myids=myids+"'"+str(ids)+"'," - myvars[ids]=varname - mydev[ids]=device - myids=myids[:-1]+')' - print(myids) - myc.execute("select gm.time,last_measures.value/1000,ids.varname,ids.device,short_names.short from (select id, max(time) as time from last_measures where id in "+myids+" group by id) gm join last_measures on last_measures.id=gm.id and last_measures.time=gm.time join ids on ids.id=gm.id join short_names on short_names.id=gm.id;") + myc.execute("select gm.time,last_measures.value/1000,ids.varname,ids.device,short_names.short from (select id, max(time) as time from last_measures group by id) gm join last_measures on last_measures.id=gm.id and last_measures.time=gm.time join ids on ids.id=gm.id join short_names on short_names.id=gm.id;") ts=myc.fetchall() myc.close() mydb.close() - tt={"temp_garten":0,"temp_dach":0,"temp_carport":0,"hum_garten":0,"hum_dach":0,"hum_carport":0,"press_garten":0,"press_dach":0,"press_carport":0,"lux_dach":0,"uv_dach":0} + tt={"temp_garten":0,"temp_dach":0,"temp_carport":0,"hum_garten":0,"hum_dach":0,"hum_carport":0,"press_garten":0,"press_dach":0,"press_carport":0,"lux_dach":0,"uv_dach":0,"temp_solar":0,"temp_bat","temp_wohnen":0,"hum_wohnen":0,"press_wohnen":0} zs=0 thp={"rasolar":{"temperature":0,"humidity":0,"pressure":0,"time":0},"ragps":{"temperature":0,"humidity":0,"pressure":0,"time":0},"ragarden":{"temperature":0,"humidity":0,"pressure":0,"time":0}} @@ -282,8 +271,6 @@ def forward_client(client): ''' - - @app.get('/cpu') def show_ids(): starttime=time.time() diff --git a/temperature.tpl b/temperature.tpl index cb1d5c4..a8b9036 100644 --- a/temperature.tpl +++ b/temperature.tpl @@ -8,8 +8,10 @@ + +
Ort Temperatur Luftfeuchte Luftdruck luxUV
CarPort {{tempdata['temp_carport']}} {{tempdata['hum_carport']}} {{tempdata['press_carport']}}
Wohnzimmer {{tempdata['temp_wohnen']}} {{tempdata['hum_wohnen']}} {{tempdata['press_wohnen']}}
Dach {{tempdata['temp_dach']}} {{tempdata['hum_dach']}} {{tempdata['press_dach']}} {{tempdata['lux_dach']}}{{tempdata['uv_dach']}}
Garten {{tempdata['temp_garten']}} {{tempdata['hum_garten']}} {{tempdata['press_garten']}}
Solarthermiemodul {{tempdata['temp_solar']}}