Edit Alarm setpoint from client

This has been asked a few times in the past, but a few years ago. I need the ability to edit alarm setpoints from the client. I know I can bind a setpoint to another tag, but I have a lot of tags to do this with - that would be pretty tedious and add a lot of tags . I had some working code using the “SQLTags Alarm Edit” goodie but that no longer works in 7.6.3 due to the alarm changes.

I see a lot of potential in the IA Labs Scripting Module, but there isn’t quite enough info there. There is system.tag.getAlarmStates, but I don’t know how to get to specific properties. I also see system.tag.editTag(tagPath, alarmConfig) which takes a “PyDictionary alarmConfig” but I have no idea what the format is.

Has anyone done this in 7.6.3?

Looked a little further and found some more hints. I’ll see if I can make this work.

I can set a setpoint with this:

system.tag.editTag(tagPath="New Tag", alarmConfig={"Alarm":[["setpointA","Value",100]]})

I found the alarmConfig format under Example 2 of addTag.

The code for system.tag.getAlarmStates does work to get the current state. I was getting tripped up by the fact that it only returns non-default values.

Yes, that’s it Tom! You’ve got the right path to your solution.

I’ve finally gotten around to working on this again.

The Alarm goodie still kind of works… the sqlt_as table still exists in my database, however it seems like it is no longer being used - replaced by sqlt_alarm and sqlt_alarm_meta. It’s kind of deceptive if you were to put the alarm goodie into a newer 7.6 version.

Is there a table structure for sqlt_alarm and sqlt_alarm_meta? The 7.6.4 SDK still has information on sqlt_as. That should be marked depreciated, and add the new information. I kind of need to see this to understand all the properties exposed using the scripting module, although it is mostly self explanatory.

It would be nice if someone would rewrite the alarm goodie to use the scripting module :slight_smile: so it works on 7.6.4.

On a side note, how supported is the scripting module? I’m starting to use it more, and just want to know this. I did a lot of this in the past working right with SQL, but that is kind of a pain.

I believe you sent an email into support asking about this, but here is the alarm history table structure. Also: the IALabs scripting module is one that we made, so we will be keeping it up to date.

I just want to edit an existing tag and add alarm to it, i tried the code snippet above, but it doesnt work with UDT Inside Tags

greets
m.bayer

Editing a tag inside a UDT uses a nested syntax that addresses the UDT, tag:attribute. There is an example in the documentation for the UDT syntax.

Example:
Datatype Structure Name: testUDT
Datatype Structure Path: testPath

Tag/Item inside the Datatype Structure: testUDTTag
I want to set the alarm for this item

i thought it would be like this:

system.tag.editTag(tagPath="testPath",alarmconfig={"testUDTTag":{"Alarm":["name","Value","testName"]}})

i dont know how to do that, can you maybe help me?

greets