Customise the Alarm eMail (or SMS)

The only way to customize the Alarm eMail (SMS) is to handle all Alarm Actions by script.

You need to do 3 littles tasks:

  • Catch the alarm event with the ONALARM event handler instruction.
  • Format the eMail the way you want by building a String.
  • Send the eMail with the SendMail instruction.

With this code, the Alarm Event is triggered every time that the Alarm State change.
Then, you need to test on which Alarm State your Tag is.

The Init_Section of the eWON will contain:

ONALARM "TagTest","GOTO ProcessTagTestAlarm"

Create a new section holding:

	A% = ALSTAT("TagTest")
	PRINT Time$;" TagTest alarm ";A%
	IF (A%=2) THEN
		Rem Send eMail only when the alarm occurs
		N$ = CHR$(10)+CHR$(13) : Rem CRLF
		A$ = "This is my customised alarm eMail for tag TagTest" + N$
		A$ = A$ + "The current value of TagTest is " + STR$(TagTest@) + N$
		A$ = A$ + "The current time is " + TIME$
		SENDMAIL "","","TagTest alarm Subject",A$