Alarm queryStatus: Read label of the alarm object

Ignition 8.0.12

I’m doing a queryStatus to get the list of all active alarms.
I need to loop trought the list of alarm objects and read the label property of each alarm.

I’m sure it’s not that hard, but can’t find any documentation example.

Thanks.

I ran into this a while back, and this post is where I got started.


This is what I ended up using, which also gets the associated data named ‘Class’.

from com.inductiveautomation.ignition.common.alarming.config import CommonAlarmProperties

def alarmStatus(displaypath):
	results = system.alarm.queryStatus(displaypath=displaypath)
	
	activeDurationData = []
	nameData = []
	labelData = []
	classData = []
	for row in results:
		activeDurationData.append(float(row.get(CommonAlarmProperties.ActiveDurationMS) / 1000.0))
		nameData.append(str(row.get(CommonAlarmProperties.Name)))
		labelData.append(str(row.get(CommonAlarmProperties.Label)))
		classValue = ''
		for prop in row.getActiveData().getProperties():
			if str(prop) == 'Class':
				classValue = str(row.get(prop))
				break
		classData.append(classValue)
	
	output = results.getDataset()
	output = system.dataset.addColumn(output,labelData,'Label',type(str()))
	output = system.dataset.addColumn(output,activeDurationData,'ActiveDuration',type(0.0))
	output = system.dataset.addColumn(output,nameData,'Name',type(str()))
	output = system.dataset.addColumn(output,classData,'Class',type(str()))
	
	return output
1 Like

WOW
Thanks!!