Etat d'interrupteur qui reste en off suite coupure edf

Posez ici vos questions d'utilisation, de configuration de DomoticZ, de bugs, de conseils sur le logiciel lui même dans son utilisation et son paramétrage.
Des forums spécifiques sont ouverts ci-dessous pour regrouper les différents sujets.
heartblood
Messages : 189
Inscription : 13 août 2015, 09:50

Re: Etat d'interrupteur qui reste en off suite coupure edf

Message par heartblood »

Gaz a écrit :oulala ça sent le moisi notre truc, voila mon résultat :

Code : Tout sélectionner

sh Fichier.sh
: is unknown -s
curl: try 'curl --help' for more information
Fichier.sh: line 3: http://192.168.1.XX:XXXX/json.htm?type=devices&rid=1: not found

Fichier.sh: line 8: syntax error: unexpected "fi" (expecting "then")
A priori pour lancer le script sh XXXX.sh suffit
On dirait qu'il y a un problème avec Curl et JQ, tu as bien installé le tout ? As tu des erreurs pendant l'installation ? http://easydomoticz.com/manipuler-les-d ... -en-shell/
Parce que le script fonctionne parfaitement chez moi :s
heartblood
Messages : 189
Inscription : 13 août 2015, 09:50

Re: Etat d'interrupteur qui reste en off suite coupure edf

Message par heartblood »

Gaz a écrit :J'ai re-écrit un peu le script par rapport à des trucs trouvé sur le net, du coup j'ai réglé une erreur mais il me répond tout un tas de choses qui me semble pas normale !

*1 le script modifié :

Code : Tout sélectionner

#!/bin/sh
result=$(curl -s http://192.168.X.XX:XXXX/json.htm?type=devices&rid=2| jq -r .result[].Havetimeout)
echo $result
if [ $result = "true" ]
    then
    sudo service domoticz.sz restart
#fi
*2 résultat :

Code : Tout sélectionner

{ "ActTime" : 1445531918, "ServerTime" : "2015-10-22 18:38:38", "Sunrise" : "08:22", "Sunset" : "18:47", "result" : [ { "AddjMulti" : 1.0, "AddjMulti2" : 1.0, "AddjValue" : 0.0, "AddjValue2" : 0.0, "BatteryLevel" : 255, "CustomImage" : 10, "Data" : "On, Level: 255 %", "Description" : "", "Favorite" : 1, "HardwareID" : 1, "HardwareName" : "Dongle", "HardwareType" : "OpenZWave USB", "HardwareTypeVal" : 21, "HaveDimmer" : true, "HaveGroupCmd" : false, "HaveTimeout" : false, "ID" : "0000201", "Image" : "Fireplace", "IsSubDevice" : false, "LastUpdate" : "2015-10-22 16:30:01", "Level" : 255, "LevelInt" : 255, "MaxDimLevel" : 100, "Name" : "Poêle", "Notifications" : "false", "PlanID" : "0", "PlanIDs" : [ 0 ], "Protected" : false, "ShowNotifications" : true, "SignalLevel" : 7, "Status" : "On", "StrParam1" : "", "StrParam2" : "", "SubType" : "ZWave", "SwitchType" : "On/Off", "SwitchTypeVal" : 0, "Timers" : "true", "Type" : "Lighting 2", "TypeImg" : "lightbulb", "Unit" : 1, "Used" : 1, "UsedByCamera" : false, "XOffset" : "0", "YOffset" : "0", "idx" : "1" }, { "AddjMulti" : 1.0, "AddjMulti2" : 1.0, "AddjValue" : 0.0, "AddjValue2" : 0.0, "BatteryLevel" : 255, "CustomImage" : 0, "Data" : "Off", "Description" : "", "Favorite" : 0, "HardwareID" : 1, "HardwareName" : "Dongle", "HardwareType" : "OpenZWave USB", "HardwareTypeVal" : 21, "HaveDimmer" : true, "HaveGroupCmd" : false, "HaveTimeout" : false, "ID" : "0000202", "Image" : "Light", "IsSubDevice" : false, "LastUpdate" : "2015-10-20 21:08:30", "Level" : 0, "LevelInt" : 0, "MaxDimLevel" : 100, "Name" : "Switch Poêle 2 \"off\"", "Notifications" : "false", "PlanID" : "0", "PlanIDs" : [ 0 ], "Protected" : false, "ShowNotifications" : true, "SignalLevel" : 7, "Status" : "Off", "StrParam1" : "", "StrParam2" : "", "SubType" : "ZWave", "SwitchType" : "On/Off", "SwitchTypeVal" : 0, "Timers" : "false", "Type" : "Lighting 2", "TypeImg" : "lightbulb", "Unit" : 1, "Used" : 1, "UsedByCamera" : false, "XOffset" : "0", "YOffset" : "0", "idx" : "2" }, { "AddjMulti" : 1.0, "AddjMulti2" : 1.0, "AddjValue" : 0.0, "AddjValue2" : 0.0, "BatteryLevel" : 255, "Counter" : "48659.391", "CounterDeliv" : "0.000", "CounterDelivToday" : "0.000 kWh", "CounterToday" : "12.365 kWh", "CustomImage" : 0, "Data" : "25982325;22677065;0;0;632;0", "Description" : "", "Favorite" : 1, "HardwareID" : 2, "HardwareName" : "Teleinfo EDF USB", "HardwareType" : "Teleinfo EDF USB", "HardwareTypeVal" : 19, "HaveTimeout" : false, "ID" : "1", "LastUpdate" : "2015-10-22 18:38:37", "Name" : "Teleinfo EDF", "Notifications" : "true", "PlanID" : "0", "PlanIDs" : [ 0 ], "Protected" : false, "ShowNotifications" : true, "SignalLevel" : "-", "SubType" : "Energy", "SwitchTypeVal" : 0, "Timers" : "false", "Type" : "P1 Smart Meter", "TypeImg" : "counter", "Unit" : 1, "Usage" : "632 Watt", "UsageDeliv" : "0 Watt", "Used" : 1, "XOffset" : "0", "YOffset" : "0", "idx" : "3" } ], "status" : "OK", "title" : "Devices" }
okv2.sh: line 7: syntax error: unexpected end of file (expecting "then")
SYNOHOME> sh okv2.sh
okv2.sh: line 3: http://192.168.1.30:8084/json.htm?type=devices: not found

okv2.sh: line 8: syntax error: unexpected end of file (expecting "then")
Si je me trompe pas, tu as juste rajouter ça : # devant le fi.
D'où l'erreur " okv2.sh: line 7: syntax error: unexpected end of file (expecting "then") "
Je te rassure le code poster avant fonctionne chez moi, je ne pense pas qu'il y ait des erreurs. Je pense plutôt que ça vient de la commande JQ
Répondre