ACK all from external button

Hi,

I start using the new alarm system and I need to setup an external ACK all button.
Can you suggest an easy way to acknoledge all alarm with a button script.

thanks

I’m certian there is a more elegant way, but this worked for me. Hope this helps!

#=================================================#
#Global Alarm Ack Button - Script
#Rev 1.0, by T. Smith 6/11/13, C: 303.827.1337
#Samuel Engineering, Denver CO
#Rev 1 Note: Original
#
#Rev 2 Note:
#
#=================================================#

#Test Table (Rem out when not used, delete when test complete)

If the developer places a table on the same screen, named “table”

it will display the same unacked data as the alarm window.

#----------------------------------------------------------------------#
#table = event.source.parent.getComponent(“Table”)
#UnackedAlarms = system.alarm.queryStatus(state=[“ActiveUnacked”])
#table.data = UnackedAlarms.getDataset()

#Define Variables
#Get all Active and Unacked alarms
#----------------------------------------------------------------------#
UnackedAlarms = system.alarm.queryStatus(state=[“ActiveUnacked”])
AlmData = UnackedAlarms.getDataset() #Create dataset of Unacked alarms

#Loop Through all alarms, and acknowledge them one at a time
#----------------------------------------------------------------------#
#Declare variables
idx = 0
#For Loop through list and ack
for r in results:
resultevent = str(Mydata.getValueAt(idx,‘EventId’)) #Get Alarm Event ID
system.alarm.acknowledge([resultevent],"") #Execute Ack

#Execute Associated PLC tags here
#----------------------------------------------------------------------#
#Plc_Alarm_Ack_Tag

There was a typo on the For Loop portion of the code, the corection is below…

#Loop Through all alarms, and acknowledge them
#----------------------------------------------------------------------#
#Declare variables
idx = 0
#For Loop through list and ack
for r in results:
resultevent = str(AlmData.getValueAt(idx,‘EventId’)) #Get Alarm Event ID
system.alarm.acknowledge([resultevent],"") #Execute Ack

Where do you declare the variable [color=#FF0000]results[/color] and [color=#FF0000]MyData[/color] thanks

With slightly less verbosity:

alarmEvents = system.alarm.queryStatus(state=["ActiveUnacked"])
alarmIds = [str(event.getId()) for event in alarmEvents]

system.alarm.acknowledge(alarmIds, "acked all from script")
3 Likes