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
Blocky with user variables won't execute
Moderator: leecollings
-
mischa
- Posts: 74
- Joined: Tuesday 07 April 2015 20:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8872
- Location: Heerhugowaard, The Netherlands
- Contact:
Re: Blocky with user variables won't execute
jvdz is right, this is to prevent loops.
Work around in LUA script (sorry no blocky);
Second example;
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
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
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
groetjes Mischa
Pi 2 - Pi 1 - Razzbery 2.0 - Fibaro FGD-211 - Fibaro FGD-212 - Fibaro FGRGBWM-441 (RGBW Module) - Fibaro FGBS321 (Universal Switch) - FGWPF-102 - TBK Home TZ67-G - Synology DS1515+ - Esp Easy (with wemos D1 mini)
-
mischa
- Posts: 74
- Joined: Tuesday 07 April 2015 20:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8872
- Location: Heerhugowaard, The Netherlands
- Contact:
Re: Blocky with user variables won't execute
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
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
Pi 2 - Pi 1 - Razzbery 2.0 - Fibaro FGD-211 - Fibaro FGD-212 - Fibaro FGRGBWM-441 (RGBW Module) - Fibaro FGBS321 (Universal Switch) - FGWPF-102 - TBK Home TZ67-G - Synology DS1515+ - Esp Easy (with wemos D1 mini)
Who is online
Users browsing this forum: No registered users and 1 guest