[Bash] Récupération du tarif EDF
Publié : 16 nov. 2014, 21:41
But : Récupération de la couleur du tarif EDF du jour pour déclenchement d'actions en fonction du tarif (bleu,blanc,rouge)
Langage : script bash
Prérequis : Aucun sinon un chmod 777 sur ce fichier pour autoriser son exécution
Déclenchement : à volonté via crontab.
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]