List all tag alarm pipelines, even inherited values

Hello,

I’m trying to list all alarm pipelines and enabled status, but using system.tag.getAlarmStates() only pulls the “changed” values, and it’s looking like system.tag.browseConfiguration and then drilling down to .getAlarms does the same thing

I’m down to pulling BasicAlarmDefinitions, and I see the class BasicAlarmDefinition has methods for isPropertyBound and isInherited, and even getOrDefault, which doesn’t work as I would expect… is there a way to pull the parent UDT’s value if it’s not overridden at the tag level?

Here’s where I’m at:

from com.inductiveautomation.ignition.common.config import Property, BasicProperty
from java.lang import String

tagConfig = system.tag.browseConfiguration( '[default]path\to\tag', False )
for tag in tagConfig:

	alarmDefs = tag.getAlarms()
	for alarmDef in alarmDefs:
	
		# print( type( alarmDef ) )
		# returns
		# <type 'com.inductiveautomation.ignition.common.alarming.config.BasicAlarmDefinition'>
				
		# i would think this would intersect with it's parent 
		# and the default would be the parent's value
		# but it just returns null
		prop = BasicProperty('ackPipeline', String)
		print( alarmDef.getOrDefault(prop) )

Thanks

Here’s my solution, which is a workaround, but better than iterating through system.tag.getAlarmStates(), checking for matches, then hitting the parent UDT separately

This will pull the tag’s value if they’re set to overridden, and if not, will pull the parent UDT’s values if they’ve been changed from “default.” (default being the values that are populated by Ignition when you create a new alarm, for instance, priority: Low), and then I’m manually setting the default value (the ‘or else’). Still not crazy about manually typing values but I don’t know of any other options

from com.inductiveautomation.ignition.common.config import Property, BasicProperty
from java.lang import String

tagConfig = system.tag.browseConfiguration( '[default]path\to\tag', False )
for tag in tagConfig:

	alarmDefs = tag.getAlarms()
	for alarmDef in alarmDefs:

		prop = BasicProperty( 'name', String )
		print( alarmDef.get( prop ) )

		prop = BasicProperty( 'enabled', String )
		print( alarmDef.getOrElse( prop, True ) )

		prop = BasicProperty( 'ackPipeline', String )
		print( alarmDef.get( prop ) )

		prop = BasicProperty( 'priority', String )
		print( alarmDef.getOrElse( prop, 'Low' ) )

		# etc...
2 Likes