This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Check group status one time in resident script
#1
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
Reply
#2
Hi,

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


BR,

Erwin
Reply
#3
I just decide this is better for permanent action, for checking every 5 seconds. May be this is incorrect decision. How do this better?
Reply
#4
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
Reply
#5
Thank you Erwin
Reply


Forum Jump: