Has anyone had any luck creating a button similar to the alarm status table acknowledge button, but for an individual device such as a motor or valve (only acknowledge the alarms for that specific device/tag)?
You can script it via the info here https://docs.inductiveautomation.com/display/DOC81/system.alarm.acknowledge
Scroll to bottom for example.
Thanks! Although I am looking for something that doesn't reference a table.
What do you mean? Those functions work anywhere, you just have to look up the UUID of the alarm you wish to clear. You don't need a table. (Look closer at the examples.)
One example references a table, but the other two examples do not. All you need is the alarm ID to pass into the function.
I don't see a method in the examples for looking up the UUID, so that's probably what is making this difficult.
Here is a method I have developed for doing this:
path = '[Sample_Tags]Ramp/Ramp3/Alarms/High Alarm' #Example Path
#The above path can be shortened to be more inclusive
#Examples:
#'[Sample_Tags]Ramp/Ramp3` #This would clear all alarms on the ramp3 tag
#'[Sample_Tags]Ramp #This would clear all alarms on all of the tags in the Ramp folder
#'[Sample_Tags] #This would clear all alarms within the provider
#'' or #None #This would clear all alarms
def getSourcePath(path):
sourcePath = path.replace('[', 'prov:').replace(']', ':/tag:').replace('/Alarms/', ':/alm:', 1) + '*'
return sourcePath
sourcePath = getSourcePath(path)
alarms = system.alarm.queryStatus(path = [sourcePath])
alarmIds = []
for alarm in alarms:
UUID = str(alarm.id)
alarmIds.append(UUID)
notes = None #If notes are required, then a method for obtaining this input will have to be developed and added here
system.alarm.acknowledge(alarmIds, notes)
Spin this up in an async call if you are using this from a button. It'll freeze the gui while it is doing this.