upload test, viac senzorov

This commit is contained in:
2021-01-30 14:27:23 +01:00
parent ec5c81a587
commit 8fce0013f7
9 changed files with 89 additions and 10 deletions

View File

@@ -20,6 +20,7 @@ class StatisticsController extends Controller
$startdate = $request->input('startdate',NULL);
$enddate = $request->input('enddate',NULL);
$range = $request->input('range',NULL);
$host = $request->input('host','balkon');
if (!in_array($type,$types)) $type = $types[0];
if ($startdate == NULL || $startdate == '') $startdate = "now()-1d";
else $startdate = sprintf("'%s'",Carbon::parse($startdate)->toDateTimeString());
@@ -34,7 +35,7 @@ class StatisticsController extends Controller
}
}
$q = sprintf("select time,min(value),max(value),mean(value),last(value) from bme280_value where host='balkon' and type='%s' and time >= %s and time <= %s group by time(%s);",$type,$startdate,$enddate,$range);
$q = sprintf("select time,min(value),max(value),mean(value),last(value) from bme280_value where host='%s' and type='%s' and time >= %s and time <= %s group by time(%s);",$host,$type,$startdate,$enddate,$range);
\Debugbar::info($q);
$result = \InfluxDB::query($q);
$points = $result->getPoints();