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.

Send notification email after change value (delay)
#2
1. Check that you have "Execute on group read" enabled. It might cause the script to run. Enabled logging for the mapped object to see where the value write or read comes from.

2. Set script "Execution mode" to "Last instance only" and use this code:
Code:
curr_value = event.getvalue()
prev_value = storage.get('prev_value')

if curr_value == prev_value then
  return
end

storage.set('prev_value', curr_value)

os.sleep(10)

if curr_value then
  subject = 'Main switch = ON'
  message = '\nState: Normal'
else
  subject = 'Main switch = OFF'
  message = '\nState: ALARM!!'
end

mail('1234@yyyyyyy.ww', subject, message)
Reply


Messages In This Thread
RE: Send notification email after change value (delay) - by admin - 15.10.2024, 13:47

Forum Jump: