Ouvrir URL pour modification virtual device fibaro HC2

Forum dédié aux problématiques concernant les scripts pour DomoticZ.
Entourez votre code et les logs avec les balises nommées code grâce au bouton <\>.
schwinny
Messages : 123
Inscription : 23 mars 2017, 21:41

Re: Ouvrir URL pour modification virtual device fibaro HC2

Message par schwinny »

Bon j'ai une erreur et je comprend pas;..

mon code est le suivant:

Code : Tout sélectionner

  GNU nano 2.5.3                            Fichier : script_variable_ActivationAlarme.lua                                                              

--Variable scripts receive 7 tables from Domoticz: 
-- otherdevices, otherdevices_lastupdate, otherdevices_svalues, otherdevices_idx, uservariables, uservariables_lastupdate and uservariablechanged

commandArray = {}


-- Path to curl
local curl = '/usr/bin/curl'

beaconHome=0
for variableName, variableValue in pairs(uservariables) do
    if string.sub(variableName,1,3)=="Tag" and variableValue ~= "AWAY" then
      beaconHome=beaconHome+1
    end
end
if otherdevices['Alarm'] == 'On' and beaconHome>=1 then   -- switch Off Alarm because 1 beacon come back Home
    table.insert (commandArray, { ['Alarm'] ='Off' } )
     print('alarm OF')
    commandArray['OpenURL']='http://192.168.1.22/api/callAction?deviceID=136&name=setProperty&arg1=ui.presence.value&arg2=%22Present%22'
elseif otherdevices['Alarm'] == 'Off' and beaconHome==0 then  -- switch On Alarm because all beacon are away
    table.insert (commandArray, { ['Alarm'] ='On' } )
        print('alarm onn')
    commandArray['OpenURL']='http://192.168.1.22/api/callAction?deviceID=136&name=setProperty&arg1=ui.presence.value&arg2=%22Absent%22'
end
return commandArray
le log est le suivant:

Code : Tout sélectionner

2017-10-03 23:50:55.751 LUA: alarm OF
2017-10-03 23:50:55.751 EventSystem: Fetching url...
2017-10-03 23:50:55.751 EventSystem: Script event triggered: /home/schwinny/domoticz/scripts/lua/script_variable_ActivationAlarme.lua
2017-10-03 23:50:55.791 (Alarm) Light/Switch (Alarm)
2017-10-03 23:50:55.954 Error: Error opening url: http://192.168.1.22/api/callAction?deviceID=136&name=setProperty&arg1=ui.presence.value&arg2=%22Present%22
2017-10-03 23:52:09.297 LUA: alarm onn
2017-10-03 23:52:09.297 EventSystem: Fetching url...
2017-10-03 23:52:09.297 EventSystem: Script event triggered: /home/schwinny/domoticz/scripts/lua/script_variable_ActivationAlarme.lua
2017-10-03 23:52:09.336 (Alarm) Light/Switch (Alarm)
2017-10-03 23:52:09.539 Error: Error opening url: http://192.168.1.22/api/callAction?deviceID=136&name=setProperty&arg1=ui.presence.value&arg2=%22Absent%22
2017-10-03 23:54:44.603 LUA: alarm OF
2017-10-03 23:54:44.603 EventSystem: Fetching url...
2017-10-03 23:54:44.603 EventSystem: Script event triggered: /home/schwinny/domoticz/scripts/lua/script_variable_ActivationAlarme.lua
2017-10-03 23:54:44.639 (Alarm) Light/Switch (Alarm)
2017-10-03 23:54:44.843 Error: Error opening url: http://192.168.1.22/api/callAction?deviceID=136&name=setProperty&arg1=ui.presence.value&arg2=%22Present%22
la variable change bien mais domptiez n'arrive pas a charger l'url.
Une idée ?
schwinny
Messages : 123
Inscription : 23 mars 2017, 21:41

Re: Ouvrir URL pour modification virtual device fibaro HC2

Message par schwinny »

personne n'a d'idée ?
vil1driver
Messages : 5661
Inscription : 30 janv. 2015, 11:07
Localisation : Rennes (35)

Re: Ouvrir URL pour modification virtual device fibaro HC2

Message par vil1driver »

Si j'ai bien une idée

Conformément au wiki je ne mettrai pas

Code : Tout sélectionner

http://
https://www.domoticz.com/wiki/Events
MAJ = VIDER LE CACHE(<-Clicable)
/!\Les mises à jour de Domoticz sont souvent sources de difficultés, ne sautez pas dessus
modules.lua

Un ex domoticzien
schwinny
Messages : 123
Inscription : 23 mars 2017, 21:41

Re: Ouvrir URL pour modification virtual device fibaro HC2

Message par schwinny »

effectivement c'était une erreur.

bon cependant ca ne fonctionne pas mieux ... :(

meme erreur
vil1driver
Messages : 5661
Inscription : 30 janv. 2015, 11:07
Localisation : Rennes (35)

Re: Ouvrir URL pour modification virtual device fibaro HC2

Message par vil1driver »

Ah mince.

Et sans les %22 ?
MAJ = VIDER LE CACHE(<-Clicable)
/!\Les mises à jour de Domoticz sont souvent sources de difficultés, ne sautez pas dessus
modules.lua

Un ex domoticzien
schwinny
Messages : 123
Inscription : 23 mars 2017, 21:41

Re: Ouvrir URL pour modification virtual device fibaro HC2

Message par schwinny »

idem, je les ai viré :)

Code : Tout sélectionner

2017-10-08 19:46:33.723 (Alarm) Light/Switch (Alarm)
2017-10-08 19:46:33.929 Error: Error opening url: 192.168.1.22/api/callAction?deviceID=136&name=setProperty&arg1=ui.presence.value&arg2=Present
Répondre