adjust temperature page

master
ademant 2019-08-19 17:18:39 +02:00
parent d41c89bc10
commit 32e804731a
2 changed files with 4 additions and 15 deletions

View File

@ -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):
</body></html>
'''
@app.get('/cpu')
def show_ids():
starttime=time.time()

View File

@ -8,8 +8,10 @@
<table>
<tr><th>Ort</th> <th>Temperatur</th> <th>Luftfeuchte </th> <th>Luftdruck </th><th>lux</th><th>UV </th></tr>
<tr><th>CarPort</th> <th>{{tempdata['temp_carport']}}</th> <th>{{tempdata['hum_carport']}} </th> <th>{{tempdata['press_carport']}} </th><th></th></tr>
<tr><th>Wohnzimmer</th> <th>{{tempdata['temp_wohnen']}}</th> <th>{{tempdata['hum_wohnen']}} </th> <th>{{tempdata['press_wohnen']}} </th><th></th></tr>
<tr><th>Dach</th> <th>{{tempdata['temp_dach']}}</th> <th>{{tempdata['hum_dach']}} </th> <th>{{tempdata['press_dach']}} </th><th>{{tempdata['lux_dach']}}</th><th>{{tempdata['uv_dach']}}</th></tr>
<tr><th>Garten</th> <th>{{tempdata['temp_garten']}}</th> <th>{{tempdata['hum_garten']}} </th> <th>{{tempdata['press_garten']}} </th><th></th><th></th></tr>
<tr><th>Solarthermiemodul</th> <th>{{tempdata['temp_solar']}}</th> <th></th> <th></th><th></th><th></th></tr>
</table>
</body>
</html>