Page 1 sur 1

Problème ouverture d'url

Publié : 15 janv. 2019, 19:53
par Wolfen38
Salut,

j'ai un script lua pour rebooter mes sonoff qui ressemble a ca :

Code : Tout sélectionner

if (devicechanged['Reboot-sonoff'] == 'On') then
commandArray['OpenURL']='http://192.168.31.31/?cmd=reboot'
commandArray['OpenURL']='http://192.168.31.190/?cmd=reboot'
commandArray['OpenURL']='http://192.168.31.59/?cmd=reboot'
commandArray['OpenURL']='http://192.168.31.176/?cmd=reboot'
commandArray['OpenURL']='http://192.168.31.242/?cmd=reboot'
commandArray['Reboot-sonoff']='Off AFTER 10'
end
Mais en log, j'ai juste ca :

Code : Tout sélectionner

2019-01-15 19:49:30.144 (Virtualsensor) Lighting 1 (Reboot-sonoff)
2019-01-15 19:49:30.135 Status: User: Wolfen38 initiated a switch command (208/Reboot-sonoff/On)
2019-01-15 19:49:30.245 Status: EventSystem: Fetching url http://192.168.31.242/?cmd=reboot...
2019-01-15 19:49:30.245 Status: EventSystem: Script event triggered: /home/pi/domoticz/scripts/lua/script_device_reboot-sonoff.lua
2019-01-15 19:49:40.288 (Virtualsensor) Lighting 1 (Reboot-sonoff)
Comme si juste la derniere url fonctionnait.

Vous voyez pourquoi ?

Re: Problème ouverture d'url

Publié : 16 janv. 2019, 06:11
par denis_brasseur
Wolfen38 a écrit : 15 janv. 2019, 19:53
Comme si juste la derniere url fonctionnait.

Vous voyez pourquoi ?


Envoi de 2 OPENURL : Seul le second est pris en compte.....

Je ne sais pas si ta syntaxe OpenURL est bonne, mais tu as 5 résultats dans le tableau "commandarray" pour la même variable "OpenURL" et donc il ne prend que la dernière...
C'est pour ça qu'on rajoute ceci:

Code : Tout sélectionner

commandArray[#commandArray+ 1] = {['OpenURL'] ='http://192.168.31.31/?cmd=reboot'}

Re: RE: Re: Problème ouverture d'url

Publié : 16 janv. 2019, 06:22
par Wolfen38
denis_brasseur a écrit :
Wolfen38 a écrit : 15 janv. 2019, 19:53
Comme si juste la derniere url fonctionnait.

Vous voyez pourquoi ?


Envoi de 2 OPENURL : Seul le second est pris en compte.....

Je ne sais pas si ta syntaxe OpenURL est bonne, mais tu as 5 résultats dans le tableau "commandarray" pour la même variable "OpenURL" et donc il ne prend que la dernière...
C'est pour ça qu'on rajoute ceci:

Code : Tout sélectionner

commandArray[#commandArray+ 1] = {['OpenURL'] ='http://192.168.31.31/?cmd=reboot'}
Ok merci j'essaie ça

Envoyé de mon Mi A1 en utilisant Tapatalk


Re: Problème ouverture d'url

Publié : 16 janv. 2019, 12:11
par Wolfen38
J'ai ca en log

Code : Tout sélectionner

2019-01-16 12:09:43.274 Status: User: Wolfen38 initiated a switch command (208/Reboot-sonoff/On)
2019-01-16 12:09:43.584 Status: EventSystem: Fetching url http://192.168.31.31/?cmd=reboot...
2019-01-16 12:09:43.584 Status: EventSystem: Fetching url http://192.168.31.59/?cmd=reboot...
2019-01-16 12:09:43.584 Status: EventSystem: Fetching url http://192.168.31.176/?cmd=reboot...
2019-01-16 12:09:43.584 Status: EventSystem: Fetching url http://192.168.31.190/?cmd=reboot...
2019-01-16 12:09:43.584 Status: EventSystem: Fetching url http://192.168.31.242/?cmd=reboot...
2019-01-16 12:09:43.585 Status: EventSystem: Script event triggered: /home/pi/domoticz/scripts/lua/script_device_reboot-sonoff.lua
Je pense que c'est bon signe, pas d'erreur, et tous les url semblent être ouvert.

Je verrais ce soir chez moi si ca fonctionne bien.

Re: Problème ouverture d'url

Publié : 18 janv. 2019, 22:04
par fifou.ita
Alors resultat?

Envoyé de mon SM-A520F en utilisant Tapatalk


Re: Problème ouverture d'url

Publié : 19 janv. 2019, 06:37
par Wolfen38
Résultat, c'est nickel, j'ai bien tous mes sonoff qui reboot à l'heure prévu.

Merci.