Blocky with user variables won't execute

Moderator: leecollings

Post Reply
User avatar
jvdz
Posts: 2445
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Blocky with user variables won't execute

Post 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
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

Post 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&param=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&param=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
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

Post 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
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)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest