# Active alarm in area?

**URL:** <https://forum.inductiveautomation.com/t/active-alarm-in-area/41892>\
**Category:** Ignition\
**Created:** [January 1, 2021, 7:56pm UTC](https://forum.inductiveautomation.com/t/active-alarm-in-area/41892 "2021-01-01T19:56:25Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [January 2, 2021, 2:25am UTC](https://forum.inductiveautomation.com/t/active-alarm-in-area/41892/5 "2021-01-02T02:25:28Z")

</div>

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](https://forum.inductiveautomation.com/uploads/short-url/qkjv7KDjjTvoyFCq6zCNnWNoXpi.json) (2.7 KB).

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

```auto
def getAlarmSummary(filterPath='*'):
	if filterPath.find(']') != -1:
		filterPath = filterPath.split(']')[1]
	alarms = system.alarm.queryStatus(priority=[1,2,3,4],
								 state=['ActiveAcked','ClearUnacked','ActiveUnacked'],
								 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”.

Edit:  
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)

---

_[View the full topic](https://forum.inductiveautomation.com/t/active-alarm-in-area/41892)._
