]> ToastFreeware Gitweb - chrisu/seepark.git/blobdiff - web/seepark_web.py
adjust sensor name (and tooltip regexp) again
[chrisu/seepark.git] / web / seepark_web.py
index bb597324065e5ae81cd3ed65fbf75e8c297aeacb..72c74e7e6573f44999957daa382926aa2afa4676 100644 (file)
@@ -46,7 +46,7 @@ config = configparser.ConfigParser()
 config.read(os.environ['SEEPARKINI'])
 apikey = config.get('openweathermap', 'apikey')
 cityid = config.get('openweathermap', 'cityid')
 config.read(os.environ['SEEPARKINI'])
 apikey = config.get('openweathermap', 'apikey')
 cityid = config.get('openweathermap', 'cityid')
-mainsensor = config.get('temperature', 'mainsensor')
+mainsensor = config.get('webapp', 'mainsensor')
 
 app = Flask(__name__)
 app.json_encoder = JSONEncoder
 
 app = Flask(__name__)
 app.json_encoder = JSONEncoder
@@ -85,16 +85,16 @@ def select_sensordata(sensor_id, sensor_type, begin, end, mode):
         )
         duration = (end - begin).total_seconds()
         day = 60 * 60 * 24
         )
         duration = (end - begin).total_seconds()
         day = 60 * 60 * 24
-        if duration < day:
+        if duration <= day:
             resolution = resolutions['day']
             resolution = resolutions['day']
-        elif duration < 7 * day:
+        elif duration <= 7 * day:
             resolution = resolutions['week']
             resolution = resolutions['week']
-        elif duration < 31 * day:
+        elif duration <= 31 * day:
             resolution = resolutions['month']
         else:
             resolution = resolutions['year']
         # TODO: filter out samples from 'result'
             resolution = resolutions['month']
         else:
             resolution = resolutions['year']
         # TODO: filter out samples from 'result'
-        # something like 
+        # something like
         # select to_seconds(datetime) DIV (60*60*24) as interval_id, min(datetime), max(datetime), min(temp), avg(temp), max(temp), count(temp) from openweathermap group by interval_id order by interval_id;
     return query.all()
 
         # select to_seconds(datetime) DIV (60*60*24) as interval_id, min(datetime), max(datetime), min(temp), avg(temp), max(temp), count(temp) from openweathermap group by interval_id order by interval_id;
     return query.all()