diff --git a/web/config.py b/web/config.py index e1e5b35..30da6ce 100644 --- a/web/config.py +++ b/web/config.py @@ -155,7 +155,7 @@ class serverConfiguration(object): return False self.val = {} for line in config_list: - if line.strip() != '': + if line.strip() != '' and '[' not in line.strip(): try: line = line.split("=") option = line[0].strip().strip("'") diff --git a/web/modules/dynamic.py b/web/modules/dynamic.py index ac60251..3854988 100755 --- a/web/modules/dynamic.py +++ b/web/modules/dynamic.py @@ -371,20 +371,27 @@ class Expose(object): def temphumi_monitor(self, **kwargs): q = check_GET(kwargs) 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 - for Thin, Thout in zip(temphumi_monitor['th_ins'], - temphumi_monitor['th_outs']): - tm_temp = str(Thin["time"]).strip() - temp_in_val = str(Thin["Temp"]).strip() - temp_out_val = str(Thout["Temp"]).strip() - hum_in_val = str(Thin["Hum"]).strip() - hum_out_val = str(Thout["Hum"]).strip() - yield "{},{},{},{},{}\n".format(tm_temp, - temp_in_val, - temp_out_val, - hum_in_val, - hum_out_val) + for Thout in temphumi_monitor['th_outs']: + print(Thout) + try: + tm_temp = str(Thout["time"]).strip() + except: + tm_temp = 'None' + try: + temp_out_val = str(Thout["Temp"]).strip() + except: + temp_out_val = 'None' + try: + hum_out_val = str(Thout["Hum"]).strip() + except: + hum_out_val = 'None' + yield "{},{},{}\n".format(tm_temp, + temp_out_val, + hum_out_val) + + @cherrypy.expose def usense_temphumi_monitor(self, **kwargs): @@ -897,15 +904,12 @@ class DynamicWeather(object): q['end'], q['granularity']) 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', tags={'type': 'external'}) - th_ints = [temphumi_in for temphumi_in in th_in] th_outs = [temphumi_out for temphumi_out in th_out] # Let's get the data from DB - result = {'th_ins':th_ints, 'th_outs':th_outs} + result = {'th_outs':th_outs} return result def pressure_graph_data(self, **q): diff --git a/web/static/js/weather_graph.js b/web/static/js/weather_graph.js index d73dff1..433a004 100644 --- a/web/static/js/weather_graph.js +++ b/web/static/js/weather_graph.js @@ -93,58 +93,6 @@ data['wind_monitor'], temphumi_out = new Dygraph( document.getElementById("temphumi"), 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: 'Outside [°C]', - y2label: 'Humidity [%]', - labelsDiv: 'temphumi_labels', - legend: 'always' - } -); - -temphumi_in = new Dygraph( -document.getElementById("temphumi_in"), -data['temphumi_monitor'], { axes : { x : { @@ -164,7 +112,7 @@ data['temphumi_monitor'], } }, rollPeriod: 5, - visibility: [true, false, true, false], + visibility: [true, true], interactionModel: {}, connectSeparatedPoints: true, series:{ @@ -174,19 +122,9 @@ data['temphumi_monitor'], 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: 'Inside [°C]', @@ -196,6 +134,7 @@ data['temphumi_monitor'], } ); +/* pressure = new Dygraph( document.getElementById("pressure"), data['pressure_monitor'], @@ -238,7 +177,7 @@ data['pressure_monitor'], labelsDiv: 'pressure_labels', legend: 'always' } -); +);*/ rrate = new Dygraph( document.getElementById("rrate"), diff --git a/web/templates/weather_admin.html b/web/templates/weather_admin.html index b68f916..835657f 100644 --- a/web/templates/weather_admin.html +++ b/web/templates/weather_admin.html @@ -75,7 +75,7 @@