I remember there being an issue with using queryStatus - I remember it excluding some tags.
Here's what I use to get a list of all configured alarms and their properties, originally written by @Kyle_Chase
"""
Description:
Finds all alarms within a given tagpath and return a bunch of the alarm properties.
https://forum.inductiveautomation.com/t/how-to-generate-a-list-of-all-configured-alarms/36651/6?u=nminchin
Revision History:
Rev Date Author Comment
1.0 ?? Kyle Chase Original
1.1 2022-10-21 Nick Minchin Fixed bit in tagpath. Wrote results to clipboard as a CSV
Return:
CVS to clipboard with alarm tag paths and collection of alarm properties.
"""
path = '[default]Wynns/Winery/Tank Farms/Fermenters/SWAP/Tanks/C168'
def getAlarms(tagPath):
from com.inductiveautomation.ignition.common.tags.paths.parser import TagPathParser
alarms = []
def iterTagConfig(dictIn, folderIn = ''):
keys = dictIn.keys()
#Move tags and alarms to end of list. I do not recall why, but it is really, really important.
if 'tags' in keys:
keys.append(keys.pop(keys.index('tags')))
if 'alarms' in keys:
keys.append(keys.pop(keys.index('alarms')))
for key in keys:
#If the value of dictIn[key] is a dict, then it is a folder like structure that has child tags. Iterate through this
if isinstance(dictIn[key], dict):
iterTagConfig(dictIn[key])
elif key == 'tags':
for tag in dictIn[key]:
if str(tag["path"]) != "_types_":
iterTagConfig(tag, folderIn = folderIn + '/' + str(dictIn['path']) + '/' if folderIn else str(dictIn['path']))
elif key == 'alarms':
#This is what we are looking for. Each tag in this alarm item is an alarm, so we add them to the list. Use qualified tag paths because they are exact, and I hear they make you look cooler.
for tag in dictIn[key]:
tp = TagPathParser.parseSafe(folderIn+"/"+str(dictIn['path']) if folderIn else str(dictIn['path']))
qp = "prov:%s:/tag:%s:/alm:%s"%(tp.source,tp.toStringPartial(),tag["name"])
p = tag.get('priority', '')
a = tag.get('activePipeline', '')
dp = tag.get('displayPath', '')
label = tag.get('label', '')
name = tag.get('name', '')
alarms.append([tp, p, a, dp, label, name])
iterTagConfig(tag,folderIn = folderIn + str(dictIn['path']))
if tagPath:
folder = tagPath
#Root level browse
nodes = system.tag.getConfiguration(folder, True)
for item in nodes:
iterTagConfig(item)
return alarms
csv = '"tagpath","priority","activePipeline","displayPath","label","name"\r\n'
for t in getAlarms(path):
csv += '"' + '","'.join([str(tt) for tt in t]) + '"\r\n'