Get Acknowledgement Notes

Is there a way to get the Acknowledgement Notes from when a user enters in a note and acknowledges an alarm?

I am using the system.alarm.acknowlegement function to ACK alarms. This seems to work fine, however, if I use the system.alarm.queryStatus to get the information for this alarm, I can't seem to find the note information. I can see the ACK note within the Alarm details section of the Alarm Status table so I know that it's getting set correctly.

Anyone else have this issue? Thoughts or suggestions on other ways to get this note information via script?

The system.alarm.queryStatus() function returns a list of alarm event objects. The available methods to use are listed in the docs here - Scripting Object Reference - Ignition User Manual 8.1 - Ignition Documentation

You can iterate through the alarms and get the notes using something like this

for alarm in system.alarm.queryStatus(path=path):
	print alarm.notes
1 Like

That is the function I am using to view the notes. I tried printing out the event.getNotes however nothing is returned

Show your code with .getNotes().

2 Likes

Here is the code that I'm using

def getAlarmEvents(path):

# Create instances list.
instances = []
user = "system"
# Get the alarm events between startDate and endDate.
alarmEvents = system.alarm.queryStatus(source='*' + path + '*',state=['ActiveUnacked', 'ActiveAcked'])	
	
# Define map to display more user-friendly text that
# denotes the type of alarm event.
eventMap = {'Active, Unacknowledged': 'Alarm Active UnAck', 'Active, Acknowledged': 'Alarm Active Ack', 'Active': 'Alarm Active'}
	
# Get event type, event time, and other alarm event
# properties to create the instance, and append the
# instance to the instances list.

for alarmEvent in alarmEvents:
	event = eventMap[str(alarmEvent.getState())]
	eventId = alarmEvent.getId()
	note = alarmEvent.getNotes()	
		
	if alarmEvent.activeData:
		for item in alarmEvent.activeData:
			
			if str(item.getProperty()) == 'eventTime':
				datetime = item.getValue()	
			if str(item.getProperty()) == 'ackUser':
				user = item.getValue()	
			if str(item.getProperty()) == 'label':
				label = item.getValue()

I did see the note listed in the alarm banner, I'm just having problems retrieving it via script.

I was finally able to do this with some help from one of the Devs. I couldn't find the documentation for dealing with the EventData object returned from getAckData(), but this is what the Dev suggested and I've confirmed it works. You'll want to re-write the logic for your approach.

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

queryResult = system.alarm.queryStatus(path="*"+path+"*",state=['ActiveAcked'])
notes = queryResult[0].getAckData().get(CommonAlarmProperties.AckNotes)
system.perspective.print(str(notes))
3 Likes

This works great, thank you very much!!

1 Like