Deleting an alarm through scripting?

How would I remove alarm definition from a tag?

EditAlarmConfig just configures existing alarms. Best I could do with it was reset all the alarm configuration to default, but I need to delete.

system.tag.editAlarmConfig(tagPaths, {'Alarm': []})

EditTag, I’m not sure what the alarmList parameter is for; the manual says it is a string type, but I think it is a string array?
I was hoping I could just not include the alarm I wanted to delete in the alarmList parameter.
No dice.

system.tag.editTag(tagPath = tagPath, alarmList = '', alarmConfig = {'Alarm': []})
- or -
system.tag.editTag(tagPath = tagPath, alarmList = [''], alarmConfig = {'Alarm': []})

I would like to know if this is possible as well.

You could disable the alarm using that script.

system.tag.editAlarmConfig(tagPaths, {'Alarm': [["enabled","Value","0"]]})

Or you might be able to do it with:

system.tag.editTag(tagPath, attributes, parameters, accessRights, overrides, alarmList, alarmConfig)

And make alarmList Blank or at least leave out the alarms you want to remove.

I think either would work, but haven’t tested them.

I have been trying to get this to work myself and was finally able to figure it out.

alarmConfig = {‘Alarm’:None}
system.tag.editTag(tagPath=tagPath, alarmConfig=alarmConfig)

This will remove the alarm named ‘Alarm’ from the tag, leaving other alarms on the tag as they are.

It seemed to me initially that the solution was to recreate the alarmConfig, removing the alarm I wanted to delete from it, and then using editTag to set it, but that did nothing.



Any of these solutions work for me. Do you have some exemple ?
I tried :

system.tag.editTag(tagPath="test", alarmList="")

No error message, but nothing happened.

alarmConfig = {'Low Temp':None}
system.tag.editTag(tagPath='test', alarmConfig=alarmConfig)

error message : Error executing gateway function.


Where did you run this code at?

In a button with an actionPerformed event.

That doesn’t make sense. I run the same code and it works fine.

Similar to denji26’s method, I was able to remove an alarm this way:


All I changed was the function (editAlarmConfig instead of editTag). This was in version 7.9.10