Creating alarms using scripting

table { border: 1px solid #c4c7c5; border-radius: 4px; font-size: 16px; } th { padding: 18px 16px; text-align: left; } td { padding: 16px; border-top: 1px solid #c4c7c5; } .katex-mathml{ display: block; text-align: center; } .katex-html { display: none; }

Hello Guys

I’m currently working on a project where I need to dynamically create alarms. I’ve set up a UDT instance in Ignition Edge and am transmitting data to standard Ignition. In my project, I have 14 folders, each containing identical tags that require alarm configuration.

To streamline this process, I’m looking for a way to automate the alarm configuration instead of manually setting it up for each tag. I attempted to use the system.tag.configure function, but I encountered a BadAccessDenied error, indicating as Insufficient Tag Provider Edit Permissions. This issue persists even when I use admin credentials.

Does anyone have suggestions on how to resolve this or alternative methods for dynamically creating alarms? Any help would be greatly appreciated. Thanks in advance!

baseTagPath = "[MQTT Engine]Edge Nodes/MxD/Chicago/Assembly Area01/Line01/Stn1/Health Check/Fault/Current Fault"

alarms = [
{
"name":"My scripting alarm",
"mode":"AboveValue",
"setpointA":10
}
]
tags = [
{
"alarms":alarms,
"name":"myTag"
}
]

collisionPolicy = "m"

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

I have tried using this script as i mentioned i got error stating "[Bad_AccessDenied("Insufficient Tag Provider Edit Permissions"

Make sure your permissions are set correctly on the edge install.

Also, why not just configure alarms in the UDTs?

If you are looking for a way to update the tags programmatically, it would be worth chasing the error you are receiving. Tag provider permissions within the Edge gateway config might be a starting point...

I would also recommend following the examples in Ignition docs for system.tag.configure in which you read the configuration of a tag, modify a specific item in the config, then write the entire config back to the tag. My preference is to also read the config of a known-good tag (which was modified using the Tag Edit UI within Designer), then extract specific key:value pairs from that 'model tag' to assign to 'target tag' props.