|
|
@ -9,6 +9,7 @@ use App\Motion\SnapshotRepository; |
|
|
|
use Symfony\Component\HttpFoundation\Response; |
|
|
|
use App\Repository\TemperatureRepository; |
|
|
|
use App\Repository\HygrometryRepository; |
|
|
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; |
|
|
|
|
|
|
|
class MonitoringController extends AbstractController |
|
|
|
{ |
|
|
@ -23,7 +24,11 @@ class MonitoringController extends AbstractController |
|
|
|
/** |
|
|
|
* @Route("/datas", name="datas") |
|
|
|
*/ |
|
|
|
public function datas(TemperatureRepository $temperatureRepository, HygrometryRepository $hygrometryRepository): Response |
|
|
|
public function datas( |
|
|
|
TemperatureRepository $temperatureRepository, |
|
|
|
HygrometryRepository $hygrometryRepository, |
|
|
|
ParameterBagInterface $params |
|
|
|
): Response |
|
|
|
{ |
|
|
|
$from = new \DateTime('now - 1 day'); |
|
|
|
$to = new \DateTime('now'); |
|
|
@ -31,6 +36,8 @@ class MonitoringController extends AbstractController |
|
|
|
return $this->render('datas.html.twig', [ |
|
|
|
'temperatures' => $temperatureRepository->findByDateRange($from, $to, 100, 'DESC'), |
|
|
|
'hygrometries' => $hygrometryRepository->findByDateRange($from, $to, 100, 'DESC'), |
|
|
|
'lightOnAt' => (int) $params->get('light_on_at'), |
|
|
|
'lightOffAt' => (int) $params->get('light_off_at'), |
|
|
|
]); |
|
|
|
} |
|
|
|
} |