2026-04-24 FE Backup
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
def update_alarms_in_udts(root_path): #, enable_tag_path, custom_props):
|
||||
"""This script will update all the alarms under a base path so that the
|
||||
alarm is enabled based on the "Meta/Alarms Enabled" tag, and the Building, EqName,
|
||||
Area Served, Location, and Alarms Enabled properties have been set to their Meta tag equivalent."""
|
||||
|
||||
def update_alarm_config(base_path, path):
|
||||
"""This function will take a tag path as an input and update the alarms."""
|
||||
|
||||
configs = system.tag.getConfiguration(path, False)
|
||||
|
||||
for config in configs:
|
||||
if "alarms" in config:
|
||||
for alarm in config["alarms"]:
|
||||
alarm["ackPipeline"] = {"bindType": "UDTParameter", "value": "{AckPipeline}"}
|
||||
alarm["activePipeline"] = {"bindType": "UDTParameter", "value": "{ActivePipeline}"}
|
||||
alarm["clearPipeline"] = {"bindType": "UDTParameter", "value": "{ClearPipeline}"}
|
||||
system.tag.configure(base_path, config, "o")
|
||||
print "The following tag was update: %s" % config["path"]
|
||||
else:
|
||||
print "\nERROR: The following tag did not have an alarm: %s\n" % config["path"]
|
||||
|
||||
|
||||
def recurse_tags(base_path):
|
||||
"""Locate all the alarms underneath a base_path and call update_alarm_config when found."""
|
||||
|
||||
tags = system.tag.browse(base_path)
|
||||
for tag in tags:
|
||||
if str(tag["tagType"]) == "UdtType":
|
||||
isUdt = True
|
||||
else:
|
||||
isUdt = False
|
||||
|
||||
if str(tag["tagType"]) == "AtomicTag" and "alarm" in tag["attributes"]:
|
||||
update_alarm_config(base_path, tag["fullPath"])
|
||||
elif tag["hasChildren"]:
|
||||
recurse_tags(tag["fullPath"])
|
||||
|
||||
recurse_tags(root_path)
|
||||
Reference in New Issue
Block a user