Ce script va vous permettre d'afficher l'état de vigilance et risque météorologique.
pour cela il faut créer un virtual alert et récupérer son IDX (http://easydomoticz.com/ajout-dun-texte ... al-sensor/)
Code : Tout sélectionner
#!/bin/bash
#vigilance.sh
color=$(curl http://api.domogeek.fr/vigilance/VOTRE DEPARTEMENT 75/color)
risk=$(curl http://api.domogeek.fr/vigilance/VOTRE DEPARTEMENT75/risk)
if [ $color = "vert" ]; then
col=1
elif [ $color = "jaune" ]; then
col=2
elif [ $color = "orange" ]; then
col=3
elif [ $color = "rouge" ]; then
col=4
echo "subject: Vigilance" $color "risque de" $risk > /var/tmp/mail.txt
echo >> /var/tmp/mail.txt
curl --url "smtps://smtp.mail.x.com:465" --ssl-reqd --mail-from "expéditeur" --mail-rcpt "destinataire" --upload-file /var/tmp/mail.txt --user "adresse compte smtp:mot de passe"$
fi
curl http://192.168.1.2:8080/json.htm?type=command\¶m=udevice\&idx=VOTRE IDX 99\&nvalue=$col\&svalue="$risk"pour l’exécuter (toute les 4 heures) un cron * */4 * * * sudo /home/pi/domoticz/scripts/vigilance.sh 2>&1 >> /dev/null