Getting alarm data and time from Alarm Status Table

Hi there,

I am trying to get the most recent active unacknowledged alarm and display it on a single-line field but I can’t seem to find the data that I look for under the props.
Is there a way to access these info? I also would like to use custom buttons to silence and/or acknowledge it.

Thanks,

You can use scripting to do this.

You can search all the alarms for the active and unacknowledged ones with this one:
https://docs.inductiveautomation.com/display/DOC81/system.alarm.queryStatus

You can shelve and acknowledge alarms with these:
https://docs.inductiveautomation.com/display/DOC81/system.alarm.acknowledge
https://docs.inductiveautomation.com/display/DOC81/system.alarm.shelve

Hi,

Thanks for the reply.
I used the system.alarm.queryStatus and can receive something like this:

{Source: ‘prov:default:/tag:GenSim/Realistic/Realistic0:/alm:High Alarm’, Display Path: ‘’, UUID: ‘426d0ccd-88ef-4c9a-b501-f3adb6c003fe’, Current State: ‘Active, Unacknowledged’, Priority: ‘Critical’, Active Data: {mode=Above Setpoint, setpointA=35.0, eventValue=39.34168542734694, name=High Alarm, eventTime=Tue Jan 25 09:32:31 CET 2022, priority=Critical}, Clear Data: null, Ack Data: null, Runtime Data: {isShelved=false}}

In fact, I only need time and alarm description. How can I extract those?

Alarm.queryStatus() returns a PyAlarmEvent (if in 1.8.11) You can read about what data you can get from it here: Scripting Object Reference - Ignition User Manual 8.1 - Ignition Documentation

In the latest version of Ignition this code should work:

data = system.alarm.queryStatus(state = ["ActiveUnacked", "ActiveAcked"])
for alarm in data:
	print alarm["EventTime"]
	print alarm.getLabel()
1 Like

I tried it and but I get the following error:

TypeError: ‘com.inductiveautomation.ignition.common.alarming.BasicAlarmEvent’ object is unsubscriptable

Even this code sample in the documentation throws the same error;

results = system.alarm.queryStatus()

for i in results:

print i[ "EventId" ]

This would be because that code only works in 8.1.11, your gateway must be an older version. In older versions the returns are AlarmEvent objects rather than PyAlarmEvent objects, so the code will be a little different. Here’s info about it: AlarmEvent

Pretty sure this would work:

data = system.alarm.queryStatus(state = ["ActiveUnacked", "ActiveAcked"])
for alarm in data:
	print alarm.getActiveData().getTimestamp()
	print alarm.getLabel()
3 Likes

It is 8.1.10. Will upgrade and check again.
Thank you very much for the help though!

It worked after the upgrade as you mentioned. Once again, thank you very much for the help!

1 Like