15.10.2024, 13:47
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:
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)