Page 2 sur 2

Re: Ouvrir URL pour modification virtual device fibaro HC2

Publié : 03 oct. 2017, 23:55
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 ?

Re: Ouvrir URL pour modification virtual device fibaro HC2

Publié : 08 oct. 2017, 01:16
par schwinny
personne n'a d'idée ?

Re: Ouvrir URL pour modification virtual device fibaro HC2

Publié : 08 oct. 2017, 08:41
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

Re: Ouvrir URL pour modification virtual device fibaro HC2

Publié : 08 oct. 2017, 19:25
par schwinny
effectivement c'était une erreur.

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

meme erreur

Re: Ouvrir URL pour modification virtual device fibaro HC2

Publié : 08 oct. 2017, 19:46
par vil1driver
Ah mince.

Et sans les %22 ?

Re: Ouvrir URL pour modification virtual device fibaro HC2

Publié : 08 oct. 2017, 19:47
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