Re: [Bash] Couleur TEMPO d'EDF
Publié : 28 avr. 2023, 17:28
Bonjour,
Voici le script mis à jour avec le format d'url actuel :
Voici le script mis à jour avec le format d'url actuel :
Code : Tout sélectionner
#!/bin/bash
DATEJOUR=$(date +%Y-%m-%d)
adresse="https://particulier.edf.fr/services/rest/referentiel/searchTempoStore?dateRelevant="
#adresse="https://particulier.edf.fr/bin/edf_rc/servlets/ejptemponew?Date_a_remonter="
#finadresse="&TypeAlerte=TEMPO"
adresse=${adresse}${DATEJOUR}${finadresse}
#echo $adresse
wget -O site.txt $adresse
#echo RechercheJour
coul_J=$(grep -Po '(?<={"couleurJourJ":")[^"]+(?=")' site.txt)
coul_J1=$(grep -Po '(?<="couleurJourJ1":")[^"]+(?=")' site.txt)
#echo $coul_J
#echo $coul_J1
#echo EnvoiDomoticz
#envoi gris
if [ $coul_J1 = "ND" ]; then
#echo "demain non determine"
curl "http://192.168.1.2:8080/json.htm?type=command¶m=udevice&idx=1968&nvalue=3&svalue=ND"
fi
if [ $coul_J1 = "TEMPO_BLEU" ]; then
#echo "demain jour bleu"
curl "http://192.168.1.2:8080/json.htm?type=command¶m=udevice&idx=1968&nvalue=0&svalue=Bleu"
fi
if [ $coul_J1 = "TEMPO_BLANC" ]; then
#echo "demain jour blanc"
curl "http://192.168.1.2:8080/json.htm?type=command¶m=udevice&idx=1968&nvalue=1&svalue=Blanc"
fi
if [ $coul_J1 = "TEMPO_ROUGE" ]; then
#echo "demain jour rouge"
curl "http://192.168.1.2:8080/json.htm?type=command¶m=udevice&idx=1968&nvalue=2&svalue=Rouge"
fi
#aujourd'hui
if [ $coul_J = "TEMPO_BLEU" ]; then
#echo "aujourd'hui jour bleu"
curl "http://192.168.1.2:8080/json.htm?type=command¶m=udevice&idx=1969&nvalue=0&svalue=Bleu"
fi
if [ $coul_J = "TEMPO_BLANC" ]; then
#echo "aujourd'hui jour blanc"
curl "http://192.168.1.2:8080/json.htm?type=command¶m=udevice&idx=1969&nvalue=1&svalue=Blanc"
fi
if [ $coul_J = "TEMPO_ROUGE" ]; then
#echo "aujourd'hui jour rouge"
curl "http://192.168.1.2:8080/json.htm?type=command¶m=udevice&idx=1969&nvalue=2&svalue=Rouge"
fi