Page 1 of 1
Re: Blocky with user variables won't execute
Posted: Saturday 25 June 2016 15:47
by jvdz
It is described in the Event Wiki that changing a user variable via a LUA event script doesn't fire any Variable event scripts. It will only do this when the variable is update through the Web interface or via JSON.
Jos
Re: Blocky with user variables won't execute
Posted: Saturday 25 June 2016 16:48
by mischa
jvdz is right, this is to prevent loops.
Work around in LUA script (sorry no blocky);
Code: Select all
http://[ip-domoticz:domoticz-port]/json.htm?type=command¶m=updateuservariable&idx=[idx-of-your- uservariable]&vname=SoundSiren&vtype=2&vvalue=1
Second example;
Code: Select all
commandArray = {}
--check if your system is armed
if (otherdevices['Alarm'] =='On')then
--If a detector is triggert)
if ((devicechanged[sensor1] == 'On') or (devicechanged[sensor2] == 'On')then
commandArray['OpenURL']="http://[ip-domoticz:domoticz-port]/json.htm?type=command¶m=updateuservariable&idx=[idx-of-your-uservariable]&vname=SoundSiren&vtype=2&vvalue=1"
end
end
return commandArray
with the above LUA script your blocky should work, replace [ip-domoticz:domoticz-port] with your domoticz ip and port and [idx-of-your- uservariable] with the idx of your SoundSiren variable. you only have to take care of the entry and exit delay times
groetjes Mischa
Re: Blocky with user variables won't execute
Posted: Saturday 25 June 2016 20:51
by mischa
Your blocky will work. if you change the uservariable by hand. you see that your siren gets activated.
The only thing is that if you change the uservariable value true LUA it gets updated but doesn't trigger the blocky
if you change it by json as in my earlier post it acts the same as you do it manualy, and your blocky gets activated.
I haven't looked at the wiki (any one can make/edit a Wiki page) and hope that it is tested. I am a professional engineer in Alarm systems, there for I would not use this solution because it is not reliable enough. I do understand that if you are on a budget or just want to give it a go. you will use this option.
If possible don't use blocky go for LUA.
Mischa