Get the list of all the tag with alarms Configured

Hello.

I am trying to get the list of all alarms configured on my Ignition project, instead of manually checking tag by tag the Alarms names. Is There any fast solution for It? I want to be able to change an alarm pipeline of any alarms throught the Scada.

A combination of system.tag.browseTags() and system.tag.getAlarmStates() should give you what you need in a script.

2 Likes

Yes thank you, that is exactly the kind of Functions I was looking for

1 Like

For the next ones:

Heere is the code to get the list of all the alarms:

        today = system.date.now()
        Author = system.tag.read("[System]Client/User/OSUsername").value
	tags = system.tag.browseTagsSimple("", "ASC")
	"""Name the column of the Dataset"""
	headers = ["Alarm_Name", "Tag_Path", "Active_Pipeline","Creation Date", "author"]
	data = []
	"""-------------------------------------------------------------------------------------------------------"""
	"""Browse tags"""
	for tag in tags:
		"""------- Verify tag currently checked contain alarm. Else, move on to the next tag ----------- """
		try:
			"""----- Get all alarm information on the tag. Can be one or many alarms condition for 1 tag ------- """
			tagDefs = system.tag.getAlarmStates(tag.fullPath)

			"""Keep only tags with alarm configured"""
			for tagDef in tagDefs:
				priority = 0
				for prop in tagDef.getAlarmProperties():
					"""Look only for alarm with medium and High severity"""
					if (prop.property == "priority" and not str(prop.value) == "Diagnostic" ):
						priority = 1
				if priority == 1:
					tagPaths = [tag.fullPath]
					""" Then Write the result in a dataset"""						
					data.append([tagDef.alarm, tag.fullPath, pipeline, system.date.format(today, "YYYY-MM-d"), Author])
		except:
			pass

4 Likes

Unfortunately, this script isn’t easily converted to v8 :frowning: The function system.tag.getAlarmStates was deprecated.

I assume that we now need to use system.tag.getConfiguration, however this only returns non-default values… so if the priority for example is set to Low, then you won’t be able to read this. I guess you could assume it’s Low if the key isn’t in the dictionary? This would require knowing the defaults of all properties though, assuming you wanted to bring back other property values as well. Also, getConfiguration eats up all available memory and subsequently kills the script for large numbers of tags…

I really don’t know the best way to approach this anymore… I can think of really dumb ways that will probably take hours to run (for a lot of tags). E.g. using system.tag.browse to find the tags, then system.tag.getConfiguration to get the configuration for each tag individually, check if it has an alarm, get the alarm names, then use system.tag.readBlocking to read the values of the alarm properties (of course I would collate a list of all tags and all properties to read, and then bulk read them)… very cumbersome to write the code and very dumb and inefficient in terms of structure… Who knows how long that will take for 350k tags. A rough estimate based on a quick simulation is >9hrs