[Bash] Récupération du tarif EDF

Vous avez créé un script LUA dont vous êtes fier, un .sh génial, un programme Python hors du commun, un Tuto, c'est ici que vous pouvez les partager.
patrice
Messages : 1720
Inscription : 22 sept. 2014, 21:51

[Bash] Récupération du tarif EDF

Message par patrice »

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.

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&param=udevice&idx=90&svalue=$tempo"
                curl "http://192.168.1.81:8080/json.htm?type=command&param=switchlight&idx=101&switchcmd="On"&level=0"
                ;;
        # tarif blanc
        blanc)
                curl "http://192.168.1.81:8080/json.htm?type=command&param=udevice&idx=90&svalue=$tempo"
                curl "http://192.168.1.81:8080/json.htm?type=command&param=switchlight&idx=101&switchcmd="Off"&level=0"
                ;;
        # actions pendant tarif rouge
        rouge)
                curl "http://192.168.1.81:8080/json.htm?type=command&param=udevice&idx=90&svalue=$tempo"
                curl "http://192.168.1.81:8080/json.htm?type=command&param=switchlight&idx=101&switchcmd="Off"&level=0"
                ;;
esac
[/quote]
Raspberry pi 3, Dongle RfxCom et Zigate +, plugin de pipiche, Volets Roulants profalux, contrôle d'éclairage, détecteurs de présence, alarme incendie, pilotage livebox ...
Objectif : WAF > 1
Répondre