fontawesome pridane, zobrazenie intervalu

This commit is contained in:
2021-01-13 09:21:38 +01:00
parent 0d489ae54a
commit 62c616be6f
13 changed files with 15873 additions and 10 deletions

View File

@@ -18,15 +18,24 @@ class MeasurementController extends Controller
$types = ['temperature','humidity','pressure'];
$type = $request->input('type', $types[0]);
$startdate = $request->input('startdate',NULL);
$enddate = $request->input('enddate',NULL);
if (!in_array($type,$types)) $type = $types[0];
if ($startdate == NULL || $startdate == '') $startdate = "now()-1d";
else $startdate = sprintf("'%s'",Carbon::parse($startdate)->toDateTimeString());
$q = sprintf("select time,value from bme280_value where host='balkon' and type='%s' and time > now()-1d",$type);
if ($enddate == NULL || $enddate == '') $enddate = "now()";
else $enddate = sprintf("'%s'",Carbon::parse($enddate)->toDateTimeString());
$q = sprintf("select time,value from bme280_value where host='balkon' and type='%s' and time >= %s and time <= %s",$type,$startdate,$enddate);
\Debugbar::info($q);
$result = \InfluxDB::query($q);
$points = $result->getPoints();
$a = [];
foreach ($points as $p) {
$a[] = [ Carbon::createFromFormat("Y-m-d\TH:i:s.u+",$p["time"],'UTC'), $p["value"]];
}
return response()->json($a);
}
/**