Logic Machine Forum
Check group status one time in resident 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: Check group status one time in resident script (/showthread.php?tid=1056)



Check group status one time in resident script - AlexLV - 23.10.2017

Hello,

need a little help  - I made resident script - alarm signal is coming from fire panel to DI Logical 1 = No fire, Logical 0 = Fire. If input is open - I need alert message once that fire alarm appeared, if input closed - I need message once fire alarm disappear. I made loop and if alarm on  - make alert message and make alert status message On. If no  alarm - make alert message alarm disappear and that message status On. But anyway could not solve my task Sad

fire = grp.getvalue('1/1/6')
firealertalarm = 1
firealertnoalarm = 1
if fire then
ugtrauksme = 1
else
ugtrauksme = 0
end
if ugtrauksme == 1 then
  if firealertalarm == 1 then
    alert('Fire alarm received')
    firealertnoalarmn = 0
  firealertalarm = 1
  else
  end
else
  if firealertnoalarm == 1 then
    alert('Fire alarm not active')
    firealertalarmnonemts = 1
    firealertalarm = 0
  else
  end
end


RE: Check group status one time in resident script - Erwin van der Zwart - 23.10.2017

Hi,

Why do you want to use a resident script for this task?


BR,

Erwin


RE: Check group status one time in resident script - AlexLV - 23.10.2017

I just decide this is better for permanent action, for checking every 5 seconds. May be this is incorrect decision. How do this better?


RE: Check group status one time in resident script - Erwin van der Zwart - 23.10.2017

Hi,

Just attach this as event based script to your object 1/1/6, it will be triggered on every event update / change so there is no need to cyclic check the object:
Code:
value = event.getvalue()
if value == true then
  alert('Fire alarm received')
else
  alert('Fire alarm not active')
end
BR,

Erwin


RE: Check group status one time in resident script - AlexLV - 23.10.2017

Thank you Erwin