Editing Alarm Priorities via system.tag.configure

Hello,

Has anyone used system.tag.configure to edit alarm priorities on the fly from a perspective or vision screen? If so would you be able to share some examples?

Thanks,

Frank

See this doc,
https://docs.inductiveautomation.com/display/DOC81/system.tag.configure

The below script was taken from the doc, I added priority. Keep in mind that doing this will wreak havoc when using UDTs, it will set the alarm as overridden.

# The provider and folder the Tag will be placed at. 
baseTagPath = "[default]"
 
# Create a list of alarms, where each alarm is a Python dictionary.
alarms = [
            {
                "name":"My scripting alarm",               
                "mode":"AboveValue",               
                "setpointA":10,
                "priority": "Low" #Added priority
            }
        ]
 
# Configure the list of Tags. We're only interacting with a single Tag, but still need to pass
# a list as an argument.
tags = [
            {
                "alarms":alarms,
                "name":"myTag"
            }
        ]
 
# Abort if this example attempts to overwrite any of your existing Tags.
collisionPolicy = "a"
 
# Create the Tag.
system.tag.configure(baseTagPath, tags, collisionPolicy)

Great point about it setting the alarm as overridden. Which is cumbersome. IMHO changing an alarm priority should not force a break in inheritance. I would also like to be able to change the priority with a simple tag write instead of the tag.configure.

Frank

I believe they are working on enhancements like that, but from what I understand they are a ways out.

To my knowledge there are only two properties you can write to using a tag write:

  1. Enabled
  2. Setpoint

It really warrants thinking about keeping alarms outside of udts and using primitive data types. Especially if you plan to allow priority configuration during runtime.

This post may be helpful,

1 Like

Great information. Thanks for the link. I’ll give it a shot.

I am using double integer alarm words with 32 alarms
configured using bit positions. I added an integer array tag to my UDT to hold the priority for each alarm 0-4. I then bind the priority of each alarm to priority[bitposition]. Works perfectly, thanks again!