Remote Acknowledge All Alarms in Gateway Script

I am trying to create a ‘Tag Change’-type Gateway Event script that will acknowledge all alarms for all users if a bit in the PLC turns to a one. After the acknowledgment, it will turn the bit back to zero (which is easy). The application is that the alarms are also at an OIT in the system, and I want an ‘Acknowledge All’ there to also acknowledge the alarms in the Ignition SCADA.

I looked at the system.alarm.acknowledge function, but was not sure if I could use something like:

system.alarm.acknowledge("", None, "")

I have a feeling I may need to have additional scripting to retrieve the alarmIds and put them into a string array. I checked system.alarm.queryStatus, but my understanding of it is that it retrieves statuses instead of ids, and it puts them into a List instead of a string array.

Is there a hidden function in Ignition SCADA that acknowledges all alarms, or does it need to be done with the system.alarm.acknowledge function? If so, what would be the correct script to use? Thanks.

We figured this out (with help from tech support), which is to use the following script:

results = system.alarm.queryStatus(state=[“ActiveUnacked”])
for item in results:
eventID = “%s” % (item.getId())
system.alarm.acknowledge([eventID], None)

Note that the last two lines should be tabbed.

The script acknowledges all active alarms in the alarm database. The code above is for use in the Client. For the Gateway, system.alarm.acknowledge needs the third argument, which is the name of the user acknowledging the alarms. For our case, it would be something like ‘OIT’. The system.alarm.queryStatus function may need to have other criteria specified if only desired areas or sources are to have their alarms acknowledged.

Thanks.

3 Likes

Just resurrecting this old thread for a moment, because a quick google search for “ignition acknowledge all alarms script” led me straight here, but when I copied and pasted the code it didn’t work. Purely because the original solution wasn’t copied in with the proper code formatting, and so the quote marks did not copy and paste correctly.

To save future me (and any other travellers) going through the same troubleshooting motions as me, here’s the correctly formatted code. I changed a couple of variable names and included alarms that are cleared but not yet acknowledged in the script.

For vision client scope:

activeAlarms = system.alarm.queryStatus(state=["ClearUnacked","ActiveUnacked"])
for alarm in activeAlarms:
	eventID = "%s" % (alarm.getId())
	system.alarm.acknowledge([eventID], None)

For perspective scope:

activeAlarms = system.alarm.queryStatus(state=["ClearUnacked","ActiveUnacked"])
for alarm in activeAlarms:
	eventID = "%s" % (alarm.getId())
	system.alarm.acknowledge([eventID], None, self.session.props.auth.user.userName)

For gateway scope, use the same code as for perspective scope, but replace self.session.props.auth.user.userName with your “acknowledged by” identifier of choice.

9 Likes