From 154b4d4c88611389c8087940416515ac2075efd3 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Tue, 25 Aug 2026 19:36:42 +0000 Subject: [PATCH] Adjust windows, return avg air data --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 9957dd4..a945e15 100644 --- a/main.py +++ b/main.py @@ -495,7 +495,7 @@ async def history(request): raise window = request.rel_url.query.get('window', window) - if window not in ['1m', '3m', '10m', '30m', '1h', '2h', '1d', '7d', '30d']: + if window not in ['1m', '3m', '5m', '10m', '30m', '1h', '2h', '1d', '7d', '30d']: raise start = int(start.timestamp()) @@ -531,7 +531,7 @@ async def history(request): q = 'select max("avg_p10") as max_p10, max("avg_p25") as max_p25 from dust where "name" = \'{}\' and time >= {}s and time < {}s group by time({}) fill(linear)'.format(name, start, end, window) elif measurement == 'air': client = sensors_client - q = 'select max("pm10") as max_p10, max("pm25") as max_p25, max("co2") as max_co2, max("voc_idx") as max_voc from air where "name" = \'{}\' and time >= {}s and time < {}s group by time({}) fill(linear)'.format(name, start, end, window) + q = 'select mean("pm10") as p10, mean("pm25") as p25, mean("co2") as co2, mean("voc_idx") as voc from air where "name" = \'{}\' and time >= {}s and time < {}s group by time({}) fill(linear)'.format(name, start, end, window) elif measurement == 'soil': client = sensors_client q = 'select mean("soil") as soil, mean("moisture") as moisture from soil where "name" = \'{}\' and time >= {}s and time < {}s group by time({}) fill(linear)'.format(name, start, end, window)