How to

How to do alarms notification for Ignition with BackStaff

BackStaff have different ways of sharing information.  In this post, we will show you how to send a dynamic message automatically to a group of users each time a new alarm changes state.  The name of this application is alarms notification.

This example is going to be developed specifically for Inductive Automation’s Ignition software.  Nonetheless, it is adaptable to other similar software.

The implementation can be done at a tag level, directly from the source of the alarm, or taking the information from the alarm database.  Here we will show you both ways.

Service for Sending Notifications to a Group

The notifications sending is realized through the stored procedure SP_InvokeService that is part of the BackStaff configuration databaseIPGIndicadores.  This service takes as parameters the function to be fulfilled that in this case is sendGroupTextMessage, and the additional parameters through the string @params:

SP_InvokeService @NombreServicio=’sendGroupTextMessage’, @params=’userName|userID|groupID|groupType|message’

This string @params separates its components utilizing the symbol “|”, which are:

userName:       It is taken for each user from the table IPGUsuarios under the field Usuario

userID:            It is taken for each user from the table IPGUsuarios under the field IDUsuario

groupID:          If the group is a user’s group, you have to look for this ID in the table IPGGrupoContactos. If the group is an administrator’s group, you have to look for this ID in the table IPGGrupoUsuarios

groupType:      Its value must be “1” if the group is a user group, or “2” if it is an administrator group

message:        The message we want to send to the group

The first step consists in creating a user in BackStaff.  This user sends the alarm notifications and then find the user ID in the table IPGUsuarios.  In this case, we create a user with name Ann and last name Operator, and then we locate her ID using the query you can see in the next figure

User ID

From the figure you can see that the ID has a value of 53.

The second step consists of creating a group of users in BackStaff.  BackStaff sends the notification to this group.  For this example, we make a group called “Power Plant” by employing a user that is not an administrator, and we look for its ID through the query.

Group ID

The third step has to do with including the user anoperator into the group “Power Plant” by using the apps for smartphones or through the WEB app.  Through the next query, we can verify that the user is within the group.

User to Group ID

The group type is “1” for the groups created by regular users.  This information is in the table IPGTipoGrupoUsuario.

In summary, the query to send the notification takes the form

SP_InvokeService @NombreServicio=’sendGroupTextMessage’, @params=’anuser|53|21|1|message’

What is missing is the definition for the message and the way of calling the stored procedure.  In the following two sections we explain how to do this.

Alarm Notification Sending Through a Tag

If you wish to send notifications upon a particular tag event, you can use a function we created for the notifications sending that has the name sendNotification within the Gateway scripts library called BackStaff.

Notification Function

The script events “Alarm Active” and “Alarm Cleared” use this function for the tag you want to link to the notification, and you have to format the message as you require it.

Notification script

Alarm Cleared Script


An example of the result of the execution of this code snippet is in the following figure.

Alarm notification



Alarm Notification Sending Through a Trigger

A more general method for sending alarm notifications consists of creating a trigger associated with the insertion of new records in the alarm database.  This permits, for example, to choose the critical alarms that belong to a particular area for notification.  This method eases the code maintenance a lot.

For the Ignition case, the alarm table has the name alarm_events.  An example of the trigger for it is the following

Alarm trigger for notifications


At the end of this post, you find the complete code for the trigger.  It selects the critical alarms (eventtype = 4) and splits the string source for the alarm in its components (provider, tagpath y alarm).  You use these components to build a message for the occurrence or end of the alarm.  The resulting example is

BackStaff Notification



Alarm notification sending from Ignition can be configured from the tags that generate the alarms or from the database where they are stored.  In both cases, the procedure to do it is short, simple, and flexible.



Tagged , , , , ,

About Johnny Alvarado

Electrical Engineer working with industrial information technology since 1994
View all posts by Johnny Alvarado →

Leave a Reply