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.

Event Script problem
#2
Hi!

Does your trigger variable has been changed?
Does your triger variable has boolean datatype? (01.002 boolean)
Put some logs in your script and try to modify event group address manually. Try this:


Code:
-- GET CURRENT DATA AS TABLE
now = os.date('*t')
TS=' del '..now.day..'/'..now.month..'/'..now.year..' alle '..now.hour..':'..now.min..':'..now.sec..'.'
-- GET MAIL ADDRESS
Dest  = grp.getvalue('32/1/41')
--GET ADDRESS EVENT FIRE
id=event.dst
--GET VALUE
value =grp.find(event.dst).value
-- GET NAME OF OBJECT
name = grp.alias(id)

log(value)
-------------------------------------------------------------------------------------
if (value == true or value == 1) then
  log('value is true')
  subject = 'Allarme Scatto'
  message = 'Inizio ' .. 'ID ' .. id .. ' - ' .. name  ..' '.. TS
  mail(Dest, subject, message)
  alert(message)
  ALM = 1
elseif (value == false or value == 0) then
  log('value is false')
  subject = 'Ripristino Allarme'
  message = 'Ripristino ' .. 'ID ' .. id .. ' - ' .. name  ..' ' .. TS
  mail(Dest, subject, message)
  ALM = 0
end
------------------------------------------------------------------------------------
--SET TOTAL NUMBER ALARM
ALM_OLD = grp.getvalue('32/1/40')

if (ALM==1) then
  Alm_N = ALM_OLD+1
elseif (ALM==0) then
  Alm_N = ALM_OLD-1
end

grp.write('32/1/40', Alm_N)
Reply


Messages In This Thread
Event Script problem - by Frank68 - 31.07.2020, 07:40
RE: Event Script problem - by fleeceable - 31.07.2020, 08:47
RE: Event Script problem - by Frank68 - 31.07.2020, 08:56
RE: Event Script problem - by fleeceable - 31.07.2020, 09:15
RE: Event Script problem - by Frank68 - 31.07.2020, 11:00

Forum Jump: