Inside temp removed, so far. Outside temp not displayed bug fixed

This commit is contained in:
2019-08-25 22:14:15 +02:00
parent 7a3890e45e
commit 5b4509709f
4 changed files with 28 additions and 85 deletions

View File

@@ -155,7 +155,7 @@ class serverConfiguration(object):
return False return False
self.val = {} self.val = {}
for line in config_list: for line in config_list:
if line.strip() != '': if line.strip() != '' and '[' not in line.strip():
try: try:
line = line.split("=") line = line.split("=")
option = line[0].strip().strip("'") option = line[0].strip().strip("'")

View File

@@ -371,21 +371,28 @@ class Expose(object):
def temphumi_monitor(self, **kwargs): def temphumi_monitor(self, **kwargs):
q = check_GET(kwargs) q = check_GET(kwargs)
temphumi_monitor = self.weather.temphumi_graph_data(**q) temphumi_monitor = self.weather.temphumi_graph_data(**q)
header = "time,T(ins),T(out),Humi(ins),Humi(out)\n" header = "time,T(out),Humi(out)\n"
yield header yield header
for Thin, Thout in zip(temphumi_monitor['th_ins'], for Thout in temphumi_monitor['th_outs']:
temphumi_monitor['th_outs']): print(Thout)
tm_temp = str(Thin["time"]).strip() try:
temp_in_val = str(Thin["Temp"]).strip() tm_temp = str(Thout["time"]).strip()
except:
tm_temp = 'None'
try:
temp_out_val = str(Thout["Temp"]).strip() temp_out_val = str(Thout["Temp"]).strip()
hum_in_val = str(Thin["Hum"]).strip() except:
temp_out_val = 'None'
try:
hum_out_val = str(Thout["Hum"]).strip() hum_out_val = str(Thout["Hum"]).strip()
yield "{},{},{},{},{}\n".format(tm_temp, except:
temp_in_val, hum_out_val = 'None'
yield "{},{},{}\n".format(tm_temp,
temp_out_val, temp_out_val,
hum_in_val,
hum_out_val) hum_out_val)
@cherrypy.expose @cherrypy.expose
def usense_temphumi_monitor(self, **kwargs): def usense_temphumi_monitor(self, **kwargs):
q = check_GET(kwargs) q = check_GET(kwargs)
@@ -897,15 +904,12 @@ class DynamicWeather(object):
q['end'], q['end'],
q['granularity']) q['granularity'])
db_results = self.influx_weather_client.query(query) db_results = self.influx_weather_client.query(query)
th_in = db_results.get_points(measurement='temphumi',
tags={'type': 'internal'})
th_out = db_results.get_points(measurement='temphumi', th_out = db_results.get_points(measurement='temphumi',
tags={'type': 'external'}) tags={'type': 'external'})
th_ints = [temphumi_in for temphumi_in in th_in]
th_outs = [temphumi_out for temphumi_out in th_out] th_outs = [temphumi_out for temphumi_out in th_out]
# Let's get the data from DB # Let's get the data from DB
result = {'th_ins':th_ints, 'th_outs':th_outs} result = {'th_outs':th_outs}
return result return result
def pressure_graph_data(self, **q): def pressure_graph_data(self, **q):

View File

@@ -93,58 +93,6 @@ data['wind_monitor'],
temphumi_out = new Dygraph( temphumi_out = new Dygraph(
document.getElementById("temphumi"), document.getElementById("temphumi"),
data['temphumi_monitor'], data['temphumi_monitor'],
{
axes : {
x : {
drawGrid: true,
drawAxis : false
},
y : {
drawGrid: false,
drawAxis : true,
},
y2 : {
drawGrid: false,
drawAxis: true,
independentTicks: true
}
},
rollPeriod: 5,
visibility: [false, true, false, true],
interactionModel: {},
connectSeparatedPoints: true,
series:{
'T(out)': {
axis: 'y',
color: '#705555',
fillGraph: true,
fillAlpha: 0.2
},
'T(ins)': {
axis: 'y',
color: '#705555',
fillGraph: true,
fillAlpha: 0.2
},
'Humi(out)': {
axis: 'y2',
color: '#222288'
},
'Humi(ins)': {
axis: 'y2',
color: '#222288'
}
},
ylabel: '<span style="color:#555555;">Outside [&deg;C]</span>',
y2label: '<span style="color:#222288;">Humidity [%]</span>',
labelsDiv: 'temphumi_labels',
legend: 'always'
}
);
temphumi_in = new Dygraph(
document.getElementById("temphumi_in"),
data['temphumi_monitor'],
{ {
axes : { axes : {
x : { x : {
@@ -164,7 +112,7 @@ data['temphumi_monitor'],
} }
}, },
rollPeriod: 5, rollPeriod: 5,
visibility: [true, false, true, false], visibility: [true, true],
interactionModel: {}, interactionModel: {},
connectSeparatedPoints: true, connectSeparatedPoints: true,
series:{ series:{
@@ -174,19 +122,9 @@ data['temphumi_monitor'],
fillGraph: true, fillGraph: true,
fillAlpha: 0.2 fillAlpha: 0.2
}, },
'T(ins)': {
axis: 'y',
color: '#705555',
fillGraph: true,
fillAlpha: 0.2
},
'Humi(out)': { 'Humi(out)': {
axis: 'y2', axis: 'y2',
color: '#222288' color: '#222288'
},
'Humi(ins)': {
axis: 'y2',
color: '#222288'
} }
}, },
ylabel: '<span style="color:#555555;">Inside [&deg;C]</span>', ylabel: '<span style="color:#555555;">Inside [&deg;C]</span>',
@@ -196,6 +134,7 @@ data['temphumi_monitor'],
} }
); );
/*
pressure = new Dygraph( pressure = new Dygraph(
document.getElementById("pressure"), document.getElementById("pressure"),
data['pressure_monitor'], data['pressure_monitor'],
@@ -238,7 +177,7 @@ data['pressure_monitor'],
labelsDiv: 'pressure_labels', labelsDiv: 'pressure_labels',
legend: 'always' legend: 'always'
} }
); );*/
rrate = new Dygraph( rrate = new Dygraph(
document.getElementById("rrate"), document.getElementById("rrate"),

View File

@@ -75,7 +75,7 @@
<h2>Temperature and Humidity</h2> <h2>Temperature and Humidity</h2>
<div id="temphumi_labels"></div><div id="temphumi_labels_in"></div> <div id="temphumi_labels"></div><div id="temphumi_labels_in"></div>
<div id="temphumi" class="container-fluid" style="width:100%;height:200px;"></div> <div id="temphumi" class="container-fluid" style="width:100%;height:200px;"></div>
<div id="temphumi_in" class="container-fluid" style="width:100%;height:200px;"></div> <!--<div id="temphumi_in" class="container-fluid" style="width:100%;height:200px;"></div>-->
<button type="button" class="btn btn-secondary" onclick="setBack('temphumi_monitor')">&lt;&lt;</button> <button type="button" class="btn btn-secondary" onclick="setBack('temphumi_monitor')">&lt;&lt;</button>
<button type="button" class="btn btn-secondary btn-sm" onclick="setHours('6','temphumi_monitor')">6h</button> <button type="button" class="btn btn-secondary btn-sm" onclick="setHours('6','temphumi_monitor')">6h</button>
<button type="button" class="btn btn-secondary btn-sm" onclick="setHours('12','temphumi_monitor')">12h</button> <button type="button" class="btn btn-secondary btn-sm" onclick="setHours('12','temphumi_monitor')">12h</button>
@@ -88,7 +88,7 @@
<h6><span id="g_tstamp_temphumi_monitor">{_timestamp}</span> UTC</h6> <h6><span id="g_tstamp_temphumi_monitor">{_timestamp}</span> UTC</h6>
</div> </div>
</section> </section>
<section class="row text-center placeholders"> <!--<section class="row text-center placeholders">
<div class="col"> <div class="col">
<div id="pressure_labels"></div> <div id="pressure_labels"></div>
<div id="pressure" class="container-fluid" style="width:100%;height:200px;"></div> <div id="pressure" class="container-fluid" style="width:100%;height:200px;"></div>
@@ -102,7 +102,7 @@
<button type="button" class="btn btn-secondary" onclick="setForth('pressure_monitor')">&gt;&gt;</button> <button type="button" class="btn btn-secondary" onclick="setForth('pressure_monitor')">&gt;&gt;</button>
<h6><span id="g_tstamp_pressure_monitor">{_timestamp}</span> UTC</h6> <h6><span id="g_tstamp_pressure_monitor">{_timestamp}</span> UTC</h6>
</div> </div>
</section> </section>-->
<section class="row text-center placeholders"> <section class="row text-center placeholders">
<div class="col"> <div class="col">
<div id="rrate_labels"></div> <div id="rrate_labels"></div>