Langage : script bash
Prérequis : Aucun sinon un chmod 777 sur ce fichier pour autoriser son exécution
Déclenchement : à volonté via crontab.
Code : Tout sélectionner
#!/bin/bash
tempo=$(curl -s "http://api.domogeek.fr/tempoedf/now")
echo $tempo
case "$tempo" in
# tarif bleu : actions à faire
bleu)
curl "http://192.168.1.81:8080/json.htm?type=command¶m=udevice&idx=90&svalue=$tempo"
curl "http://192.168.1.81:8080/json.htm?type=command¶m=switchlight&idx=101&switchcmd="On"&level=0"
;;
# tarif blanc
blanc)
curl "http://192.168.1.81:8080/json.htm?type=command¶m=udevice&idx=90&svalue=$tempo"
curl "http://192.168.1.81:8080/json.htm?type=command¶m=switchlight&idx=101&switchcmd="Off"&level=0"
;;
# actions pendant tarif rouge
rouge)
curl "http://192.168.1.81:8080/json.htm?type=command¶m=udevice&idx=90&svalue=$tempo"
curl "http://192.168.1.81:8080/json.htm?type=command¶m=switchlight&idx=101&switchcmd="Off"&level=0"
;;
esac
[/quote]