Active alarm in area?

I use a UDT for this in Ignition that gets a summary of alarms based on where the UDT is located.

UDT json is attached Area Alarms.json (2.7 KB).

You’ll need this script as well to summarise the alarms, put under a script library called shared.alarms:

def getAlarmSummary(filterPath='*'):
	if filterPath.find(']') != -1:
		filterPath = filterPath.split(']')[1]
	alarms = system.alarm.queryStatus(priority=[1,2,3,4],
								 path=['*:/tag:%s' % filterPath])
	almCounts = {'ActiveAcked':0, 'ActiveUnacked':0, 'ClearUnacked':0}
	for alarm in alarms:
		if str(alarm.state) == 'Cleared, Unacknowledged':
			almCounts['ClearUnacked'] += 1
		if str(alarm.state) == 'Active, Unacknowledged':
			almCounts['ActiveUnacked'] += 1
		if str(alarm.state) == 'Active, Acknowledged':
			almCounts['ActiveAcked'] += 1
	json = system.util.jsonEncode(almCounts)
	return json

Then, simply instantiate the UDT anywhere you want a summary of alarms. Make sure to name it “Area Alarms”.

This has a couple of dependencies:

  1. put the the script library into the gateway scripting project
  2. either change the expression tags’ tag group, or add a new tag group called Area Alarms, subscribed at a rate of x seconds (I set to 5s)