Unable to Read Disabled Alarm Properties

Is the system.tag.getConfiguration function supposed to be able to read properties of a tag’s pre-configured alarm if the alarm on the tag is disabled? It seems that disabled alarms are currently ignored by the system.tag.getConfiguration function and I’m not sure if that’s intended or not.

I’m trying to allow users to enable/disable specific alarms from a component within a view and all of the alarms will already have their own properties configured. I would prefer to not have to rewrite the properties manually in scripting if I can just read them using system.tag.getConfiguration(), change the ‘enabled’ property, and write the updated alarm back using system.tag.configure() instead.

Hi swolnisty.

Below are simple scripts that you can use to modify the tag properties using both the system.tag.getConfiguration. Inconjunction with system.tag.configure. The tag I am using is called average_AH. The first thing you will do is read the properties from the tag you are using.

https://docs.inductiveautomation.com/display/DOC80/system.tag.getConfiguration

path = ‘[default]average_AH’

tags = system.tag.getConfiguration(path)

for tagDict in tags:

# Iterate over the dictionary with the iteritems function
for key, value in tagDict.iteritems():
     
    # Do something with the keys and values
    print key, ' : ', value

The results will be simillar to the ones below:

tagGroup : Default
dataType : Boolean
alarms : [{u’setpointA’: 1.0, u’priority’: Medium, u’enabled’: False, u’name’: u’Alarm’}]
enabled : True
path : [default]average_AH
tagType : AtomicTag
name : average_AH
accessRights : Read_Write
valueSource : memory
value : True

Then modify the properties to the specific tag you want.

https://docs.inductiveautomation.com/display/DOC80/system.tag.configure.

baseTagPath = “[default]”

average_AH = {
“name”: “average_AH”,
“tagGroup” : “Default Historical”
“valueSource”: “memory”,
“value” : “False”,
“enabled” : “True”
“alarms” : “[{u’setpointA’: 1.0, u’priority’: Medium, u’enabled’: True, u’name’: u’Alarm’}”
}

tagList = [average_AH]

Set the collision policy. If editing existing tags, then we’ll use “o” to overwrite…

#collisionPolicy = “o”
#…however, in this example, we’ll just abort
collisionPolicy = “o”

system.tag.configure(baseTagPath, tagList, collisionPolicy).

You will modify the “alarms : u’enabled’: True” to true or false based on what you are trying to do you can do this in the script console.

Thanks,
Anthony

Thanks for the reply Anthony! My question is not really about the scripting steps required to read tag properties and overwrite new properties to tags, it’s specifically about the fact that any disabled alarms on a tag are not returned when using the system.tag.getConfiguration function.

For example, if you have a tank level tag with two pre-configured alarms (“Hi_Alm” and “Lo_Alm”) where one alarm is disabled and the other is enabled, then the following script only prints the name of the enabled alarm:

tagPath = '[default]Tank/Level'
tagConfig = system.tag.getConfiguration(tagPath)
alarms = tagConfig[0]['alarms']
for alarm in alarms:
	print alarm['name']

Is that normal? I would assume that this script should print all alarms currently configured on the Level tag, regardless of whether they are enabled or not.

Thanks!

Hi Swolnisty,

Could you download the latest 8.0.4 nightly build and see if it works correctly for you? Because I followed the steps you provided above created two alarms and set one to disabled the other to enabled and it printed out both alarms. I even changed both to disabled and it printed both alarms.

Thanks,
Anthony

Anthony,

The 8.0.4 nightly build DID correct that! I’ve been staying away from the nightly builds because every time I install one on our development server it seems to break some functionality somewhere in our current system, so I hadn’t noticed that this was fixed. I had only tested it up to 8.0.3. Thanks for pointing that out!

swolnisty

The nightly build are experimental and as such should be tried in a different non-production environment. That allows you to experiment with any new fixes without affect you currently environment. Happy to know that it works.

Anthony,