add documentation
Tento commit je obsažen v:
rodič
c345534871
revize
4bf10c0f11
79
README.md
Normální soubor
79
README.md
Normální soubor
|
@ -0,0 +1,79 @@
|
|||
Terrarium
|
||||
=========
|
||||
|
||||
Application web qui met en graphiques les mesures de température
|
||||
et d'hygrométrie ainsi que la vidéo surveillance d'un terrarium
|
||||
munie d'un Raspberry PI.
|
||||
|
||||
Le Raspberry PI utilisé est le modèle 4 avec 2Go de RAM muni de
|
||||
Raspbian Lite. La vidéo s'appuie sur la caméra fisheyes à vision
|
||||
nocturne et le logiciel Motion combiné au frontend MotionEye.
|
||||
Le capteur est un AM2302 et mesure la température et l'hygrométrie.
|
||||
|
||||
[Lire l'article de blog dédié à ce projet](https://www.deblan.io/post/580/monitoring-d-un-terrarium)
|
||||
|
||||
![](https://upload.deblan.org/u/2020-03/5e7aa73f.jpg)
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
### Récupération du projet et installation des dépendances
|
||||
|
||||
Développé et testé avec PHP 7.4, [composer](https://getcomposer.org/) et [npm](https://www.npmjs.com/) requis.
|
||||
|
||||
```
|
||||
git clone https://gitnet.fr/deblan/terrarium-web.git
|
||||
cd terrarium-web
|
||||
composer install
|
||||
npm install
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
Éditer le fichier `.env` et renseigner [`DATABASE_URL`](https://symfony.com/doc/4.4/configuration.html#configuring-environment-variables-in-env-files). Indiquer également l'adresse web de la caméra (via motion).
|
||||
|
||||
```
|
||||
php bin/console doctrine:migrations:diff
|
||||
php bin/console doctrine:migrations:execute --up XXXXXXXXXXXXX
|
||||
```
|
||||
|
||||
Exemples d'appels à l'API avec [httpie](https://httpie.org/)
|
||||
------------------------------------------------------------
|
||||
|
||||
Ajouter une mesure de température :et une mesure d'hygrométrie :
|
||||
|
||||
```
|
||||
http POST 'https://application/api/temperature/create' date='2020/04/04 18:40:02' value=30.200000762939453
|
||||
```
|
||||
|
||||
Ajouter une mesure d'hygrométrie :
|
||||
|
||||
```
|
||||
http POST 'https://application/api/hygrometry/create' date='2020/04/04 18:40:02' value=25.799999237060547
|
||||
```
|
||||
|
||||
|
||||
Videos
|
||||
------
|
||||
|
||||
Les vidéos générées par Motion doivent être copiées dans `public/motion/snapshots`.
|
||||
Voici le script qui réalise la copie depuis le serveur de l'application web :
|
||||
|
||||
```
|
||||
#!/bin/sh
|
||||
|
||||
SNAPSHOTS_DIRECTORY="$HOME/web/motion/snapshots/"
|
||||
|
||||
rsync -avz --exclude lastsnap.jpg pi@terrarium:/var/lib/motioneye/Camera1/ "$SNAPSHOTS_DIRECTORY"
|
||||
|
||||
for PARENT in "$SNAPSHOTS_DIRECTORY"*; do
|
||||
for MOVIE in "$PARENT"/*.mp4; do
|
||||
THUMB="$(echo "$MOVIE" | sed 's/.mp4/.jpg/')"
|
||||
|
||||
if [ ! -f "$THUMB" ]; then
|
||||
ffmpeg -i "$MOVIE" -vcodec mjpeg -vframes 1 -an -f rawvideo -s 300x168 -ss 1 "$THUMB"
|
||||
fi
|
||||
done
|
||||
done
|
||||
```
|
|
@ -28,8 +28,7 @@
|
|||
"symfony/validator": "4.4.*",
|
||||
"symfony/web-link": "4.4.*",
|
||||
"symfony/web-server-bundle": "4.4.*",
|
||||
"symfony/yaml": "4.4.*",
|
||||
"twbs/bootstrap": "^4.4"
|
||||
"symfony/yaml": "4.4.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/debug-pack": "*",
|
||||
|
|
62
package-lock.json
vygenerováno
Normální soubor
62
package-lock.json
vygenerováno
Normální soubor
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
"requires": true,
|
||||
"lockfileVersion": 1,
|
||||
"dependencies": {
|
||||
"bootstrap": {
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.4.1.tgz",
|
||||
"integrity": "sha512-tbx5cHubwE6e2ZG7nqM3g/FZ5PQEDMWmMGNrCUBVRPHXTJaH7CBDdsLeu3eCh3B1tzAxTnAbtmrzvWEvT2NNEA=="
|
||||
},
|
||||
"chart.js": {
|
||||
"version": "2.9.3",
|
||||
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-2.9.3.tgz",
|
||||
"integrity": "sha512-+2jlOobSk52c1VU6fzkh3UwqHMdSlgH1xFv9FKMqHiNCpXsGPQa/+81AFa+i3jZ253Mq9aAycPwDjnn1XbRNNw==",
|
||||
"requires": {
|
||||
"chartjs-color": "^2.1.0",
|
||||
"moment": "^2.10.2"
|
||||
}
|
||||
},
|
||||
"chartjs-color": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmjs.org/chartjs-color/-/chartjs-color-2.4.1.tgz",
|
||||
"integrity": "sha512-haqOg1+Yebys/Ts/9bLo/BqUcONQOdr/hoEr2LLTRl6C5LXctUdHxsCYfvQVg5JIxITrfCNUDr4ntqmQk9+/0w==",
|
||||
"requires": {
|
||||
"chartjs-color-string": "^0.6.0",
|
||||
"color-convert": "^1.9.3"
|
||||
}
|
||||
},
|
||||
"chartjs-color-string": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/chartjs-color-string/-/chartjs-color-string-0.6.0.tgz",
|
||||
"integrity": "sha512-TIB5OKn1hPJvO7JcteW4WY/63v6KwEdt6udfnDE9iCAZgy+V4SrbSxoIbTw/xkUIapjEI4ExGtD0+6D3KyFd7A==",
|
||||
"requires": {
|
||||
"color-name": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"color-convert": {
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
||||
"requires": {
|
||||
"color-name": "1.1.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"color-name": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
|
||||
}
|
||||
}
|
||||
},
|
||||
"color-name": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
||||
},
|
||||
"moment": {
|
||||
"version": "2.24.0",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz",
|
||||
"integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg=="
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"bulma": "^0.8.0",
|
||||
"bootstrap": "^4.4.1",
|
||||
"chart.js": "^2.9.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ class Snapshot
|
|||
protected DateTime $date;
|
||||
|
||||
protected string $movie;
|
||||
|
||||
|
||||
protected string $thumbnail;
|
||||
|
||||
public function setDate(DateTime $date): self
|
||||
|
|
|
@ -528,9 +528,6 @@
|
|||
"symfony/yaml": {
|
||||
"version": "v4.4.5"
|
||||
},
|
||||
"twbs/bootstrap": {
|
||||
"version": "v4.4.1"
|
||||
},
|
||||
"twig/extra-bundle": {
|
||||
"version": "v3.0.3"
|
||||
},
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
<title>{% block title %}Terrarium{% endblock %}</title>
|
||||
<link rel="icon" type="image/png" href="{{ asset('favicon.png') }}" >
|
||||
{% block css %}
|
||||
<link rel="stylesheet" href="{{ asset('assets/bootstrap/css/bootstrap.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('node_modules/chart.js/dist/Chart.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('node_modules/bootstrap/dist/css/bootstrap.min.css') }}?v={{ assetCache }}">
|
||||
<link rel="stylesheet" href="{{ asset('node_modules/chart.js/dist/Chart.min.css') }}?v={{ assetCache }}">
|
||||
<link rel="stylesheet" href="{{ asset('assets/css/app.css') }}?v={{ assetCache }}">
|
||||
{% endblock %}
|
||||
</head>
|
||||
|
@ -47,7 +47,7 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
<script src="{{ asset('node_modules/chart.js/dist/Chart.bundle.min.js') }}"></script>
|
||||
<script src="{{ asset('node_modules/chart.js/dist/Chart.bundle.min.js') }}?v={{ assetCache }}"></script>
|
||||
<script src="{{ asset('assets/js/app.js') }}?v={{ assetCache }}"></script>
|
||||
{% endblock %}
|
||||
</body>
|
||||
|
|
Načítání…
Odkázat v novém problému