Added service

This commit is contained in:
EpicKiwi 2025-01-07 21:08:16 +01:00
parent 10c570b552
commit c742c91682
Signed by: epickiwi
GPG Key ID: C4B28FD2729941CE
2 changed files with 12 additions and 2 deletions

View File

@ -13,7 +13,7 @@ while $(true); do
if [[ "$state" = "false" ]]; then if [[ "$state" = "false" ]]; then
echo "Porte ouverte, 30 secondes avant l'ouverture du local" echo "Porte ouverte, 30 secondes avant l'ouverture du local"
sleep 3 sleep 30
if [[ "$(isClosed)" = "false" ]]; then if [[ "$(isClosed)" = "false" ]]; then
systemctl start lol-opening.service systemctl start lol-opening.service
fi fi
@ -21,7 +21,7 @@ while $(true); do
else else
echo "Porte fermee, 10 secondes avant la fermeture du local" echo "Porte fermee, 10 secondes avant la fermeture du local"
sleep 1 sleep 10
if [[ "$(isClosed)" = "true" ]]; then if [[ "$(isClosed)" = "true" ]]; then
systemctl stop lol-opening.service systemctl stop lol-opening.service
fi fi

10
mqtt-lol-opener.service Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=Ouverture automatique du local via mqtt
Require=network.target
[Service]
ExecStart=/opt/mqtt-lol-opener/lol-opener.sh
Type=exec
[Install]
WantedBy=multi-user.target