Logic Machine Forum
grp.update() - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: grp.update() (/showthread.php?tid=3536)



grp.update() - Kapudan - 31.08.2021

Hi all,

I wrote an event-base script, triggered by 1/1/1, to be executed only if even 1/1/2 is true.

group address/tag = 1/1/1 (trigger)


To avoid the script being retriggered during its execution I thought to use this code:

a = grp.getvalue(1/1/1)
b = grp.getvalue(1/1/2)

if (a and b) then
  grp.update('1/1/2', 0)
  ....
  ....actions
  ....
  grp.update('1/1/2', 1)
end

I have two questions:

1) is there a better way to avoid retriggering (i.e. enable/disable script)?

2) why I can see a telegram, on the ETS group monitor, in conjuction with each update instruction even if with grp.update() 
"no KNX/TP telegram is sent, only internal value is changed"?

Thanks


RE: grp.update() - admin - 31.08.2021

1. Do you have some long sequence with sleep calls there?
2. ETS is connected via IP so telegrams are visible there.


RE: grp.update() - Kapudan - 31.08.2021

Yes,

the original code is something like..

if (a and b) then
action 1
sleep 5 minutes
action2
end

Objectively there are two problems.
The first one is that a script is triggered both with value 0 or 1 of the trgger (this is the reason for the initial AND)
The second one is that each time a trigger is received a "brand new" copy of the same event-based script is executed, so after 5 minutes the first script executes action 2 even if a second script (or a third or..) is still running.

The simplest solution is the use of a.. scene.
It's possible to choose if the scene is executed when trigger address is 0 or 1 and a new trigger restarts the same scene extending the overall time.


Now I only have to make an external AND logic (1/1/1 AND 1/1/2) whose result will trigger the scene


RE: grp.update() - Daniel - 31.08.2021

You will be better to use build in scene to run your actions with the delay as each new trigger will cancel already running scene.