Application Note - Update SMS and Email alarm recipients in on go

This is a common question from my customers and it is easy!

  1. set up two memory string tags:
    OnDutyEmail
    OnDutyMobile

    Make sure they are retainable values

image

  1. Copy and paste the scripts below to the Init Section of BASIC IDE

ONCHANGE “OnDutyMobile”, “Goto SMSDestination”
ONCHANGE “OnDutyEmail”, “Goto EmailDestination”

SMSDestination:
D$ = OnDutyMobile@ + “,gsm,0”
NBTAGS% = GETSYS PRG,“NBTAGS”
For i%=0 To NBTAGS%-1
Setsys Tag,“load”,-i%
P$ = Getsys Tag,“AlEnabled”
REM Only change SMS number of Tags belonging to Page nr 2
If Val(P$) = 1 Then
Setsys Tag,“STO”,D$ : REM SMS To field of Tag_1
Setsys TAG,“save”
Endif
Next i%
CFGSAVE : REM Writes configuration to flash
LogEvent "SMS Number changed to: " + D$,100
Print “yea”
END

EmailDestination:
D$ = OnDutyEmail@
NBTAGS% = GETSYS PRG,“NBTAGS”
For i%=0 To NBTAGS%-1
Setsys Tag,“load”,-i%
P$ = Getsys Tag,“AlEnabled”
REM Only change SMS number of Tags belonging to Page nr 2
If Val(P$) = 1 Then
Setsys Tag,“ETO”,D$ : REM SMS To field of Tag_1
Setsys TAG,“save”
Endif
Next i%
CFGSAVE : REM Writes configuration to flash
LogEvent "Email changed to: " + D$,100
Print “hey”
END

  1. save and run, turn on auto run
    image

  2. Bob is your uncle

1 Like

Thank you for sharing this Tom. I’ll have to try it out!