Page 1 sur 1

404 not found dans script bash

Publié : 09 janv. 2018, 18:08
par lucien.m
Bonjour,
Nouveau dans le domaine de la domotique.
Je voudrais à l'aide d'un interrupteur virtuel couper l'alimentation du chauffe eau lors des jours EJP, je ne puis le faire au travers d'un relais EJP .
J'ai donc essayé le code suivant qui récupère la donnée EJP sur Domogeek et devrait activé ou désactivé l'interrupteur mais j'obtiens l'erreur suivante:<html><head><title>Not Found</title></head><body><h1>404 Not Found</h1></body></html>
Voilà mon code:
#!/bin/bash
ejp=$(curl -s "http://domogeek.entropialux.com/ejpedf/nord/today")
if [ $ejp = "None" ];then
curl "http://192.XXXXXXX:8080//json.htm?type= ... n"&level=0"
else
curl "http://192.XXXXXXX:8080//json.htm?type= ... f"&level=0"
fi
Si quelqu'un de sympa pouvait m'aider
Merci

Re: 404 not found dans script bash

Publié : 09 janv. 2018, 20:59
par Neutrino
Bonjour,

Tu as un / de trop devant json.htm et des guillemets en trop :

Code : Tout sélectionner

#!/bin/bash
ejp=$(curl -s "http://domogeek.entropialux.com/ejpedf/nord/today")
if [ $ejp = "None" ];then
curl "http://192.XXXXXXX:8080/json.htm?type=command&param=virtualsensor&idx=29&switchcmd=On&level=0"
else
curl "http://192.XXXXXXX:8080/json.htm?type=command&param=virtualsensor&idx=29&switchcmd=Off&level=0"
fi

Re: 404 not found dans script bash

Publié : 11 janv. 2018, 13:15
par lucien.m
Merci Neutrino
La commande fonctionne en la lançant, j'ai un status "ERR"
Avez vous une idée d'où celà peut provenir?

Re: 404 not found dans script bash

Publié : 11 janv. 2018, 19:58
par Neutrino
Bonjour,

C'est sans doute ta commande json qui n'est pas bonne.
Je ne sais pas où tu as été chercher ce param=virtualsensor :roll:
Si c'est un simple interrupteur virtuel :

Code : Tout sélectionner

#!/bin/bash
ejp=$(curl -s "http://domogeek.entropialux.com/ejpedf/nord/today")
if [ $ejp = "None" ];then
curl "http://192.XXXXXXX:8080/json.htm?type=command&param=switchlight&idx=29&switchcmd=On"
else
curl "http://192.XXXXXXX:8080/json.htm?type=command&param=switchlight&idx=29&switchcmd=Off"
fi
Tu trouveras plus d'info ici : http://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s
Et en français : https://easydomoticz.com/traduction-fra ... -domoticz/

[RESOLU] 404 not found dans script bash

Publié : 11 janv. 2018, 20:51
par lucien.m
Bonsoir,
Merci beaucoup, super celà fonctionne. J'avais trouvé le virtualsensor sur le net.
Tout n'y est pas toujours exact.