(25.01.2019, 08:58)admin Wrote: You need to use storage to save current fault state so message is sent only once on status change:
Code:FAULT1 = grp.getvalue('14/1/34') -- Status FAULT1 FAULT2 = grp.getvalue('13/1/34') -- Status FAULT2 fault_status = storage.get('fault_status', false) subject = 'FAULT' message = 'FAULT' subject1 = 'OK' message1 = 'OK' if FAULT1 == 10 or FAULT2 == 10 then if not fault_status then mail('@', subject, message) storage.set('fault_status', true) end else if fault_status then mail('@', subject1, message1) storage.set('fault_status', false) end end
Perfect as always.
Thank you so much.
B.R.