system.tag.addTag() and PyDictionary alarmConfig

I’m trying to add an OPC tag with an alarm via system.tag.addTag()

The example in the manual is as follows:

system.tag.addTag(parentPath="", name="TagAlarm", tagType="OPC", dataType="Int2", attributes={"OPCServer":"Ignition OPC-UA Server", "OPCItemPath":"[MLX]N7:0"}, alarmConfig={"Alarm 1":[["name", "Value", "Alarm 1"], ["setpointA", "Value", 1.0]], "Alarm":[["name", "Value", "Alarm"], ["Something", "Value", "sdfsdfs"], ["enabled", "Expression", "1=2"]]})

How do you find the name of the property that you want to change? In the example above “name”, “Something”, and “enabled” make sens but “setpointA” is assigned the value of “1.0” and I’m unclear where they got “setpointA” from…? How can I figure out what the other property references would be called?

I figured it out and I’ll put my solution here for future reference. I was able to do it with the following code:

tagDefs = system.tag.getAlarmStates("[Test]/Alarms/TestTag")
for tagDef in tagDefs:
    print tagDef.alarm
    for prop in tagDef.getAlarmProperties():
    	print, prop.type, prop.value

As long as the property I was looking for had something assigned to it I was able to get the property name in the output.

1 Like