any method to retrieve a list of alarm tags that i have configured? my system have a lot of tags and i am finding a way to list out all the available alarms in the system.
Perhaps you could use the system.alarm.queryStatus() function and use a wild card to get all the alarms.
Best,
not sure if this will work in 7.7 but it will in 7.5 and 7.6 as long as you have the ialabs module. It will run thru all of your tag folders and print out the tagpath of any tag with an alarm configured and whether the alarm is analog or digital. be prepared, if you have alot of tags it will take quite a while.
tagProvider = '[put the tag provider name here]'
folder = ''
folderPath = tagProvider + folder
tags = system.tag.browseTags(tagProvider + folder,recursive=1)
for tag in tags:
tagAlert = system.tag.read(tagProvider + tag.path + '.alertmode').value
if tagAlert != 0:
if tagAlert == 1:
print tag.path + ' = digital'
elif tagAlert ==2:
print tag.path + ' = analog'
For posterity:
Using system.alarm.queryStatus(source="*")
as Nick suggested is far quicker than using browseTags. It also gets you access to all of the alarm's configuration properties, rather than just the modified-from-default properties.
Hi, How can I do that in Ignition 8.0.14? it seems that system.alarm.queryStatus() is obsolete because it throws the following error when I execute this:
system.alarm.queryStatus(state=[âActiveUnackedâ],path=["[Empresa01Tags]Area 02/Nivel"])
Traceback (most recent call last):
** File ââ, line 3, in **
AttributeError: âcom.inductiveautomation.ignition.designer.gui.toolâ object has no attribute 'queryStatusâ
I use this in 8.1.0 to get a list of the configuration of all alarms.
Just change the folder path for your project.
def PrintAlarms():
alarms = GetAlarmData()
for alarm in alarms:
print alarm
def GetAlarmData():
alarms = []
# tag folder
folder = "[Default]"
# read the configuration of all tags
nodes = system.tag.getConfiguration(folder, True)
# get a list of all alarms in this folder including nested tags
alarms = GetAlarms(nodes, '')
return alarms
# Get alarms from all tags and nested tags
def GetAlarms(nodes, path=''):
alarms = []
# check each node
for item in nodes:
# each tag has the following keys:
# name.
# path.
# tagType.
# tags.
if 'name' in item:
tagName = item['name']
else:
tagName = 'Unknown'
tagType = item['tagType']
if path == '':
tagPath = str(item['path'])
else:
tagPath = path + '/' + str(item['path'])
if 'tags' in item:
# found some nested tags
alarms += GetAlarms(item['tags'], tagPath)
if 'alarms' in item:
# found some alarms
for alarm in item['alarms']:
# add the tag details to the alarms list
alarm['TagName'] = tagName
alarm['TagPath'] = path
alarms.append(alarm)
return alarms
It shoudn't be. It works on 8.1.0 Script Console. Where are you trying to use it?