Logic Machine Forum
alert script - 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: alert script (/showthread.php?tid=3570)



alert script - davidchispas - 21.09.2021

Hi, I want to create a script per tag for multiple objects. It is to generate an alert when the input value is true for at least 60 sec. This way I avoid false alarms.

When the value of the object is true, it waits for 60 seconds and rechecks the state of the object, but that doesn't work for me. Surely it can be done in another way ...



Code:
ID = event.getvalue()
value = grp.find(event.dst).value

if ID then
  os.sleep(20)
 
  if value then
  grp.write('1/1/2',true)
    else
    grp.write('1/1/2',false)
end
  end



RE: alert script - admin - 21.09.2021

You need to call grp.find (or grp.getvalue) after the os.sleep not before it.