Overriding Properties in UDT Instances by system.tag.writeAsync()

Would this work for you?

def overrideAlarmConfig(tagPath, alarmName, alarmProperty, value):
	config = system.tag.getConfiguration(tagPath)[0]
	for alarm in config['alarms']:
		if alarm['name'] == alarmName:
			alarm[alarmProperty] = value
			break
	basePath = tagPath.rsplit('/',1)[0]
	system.tag.configure(basePath, config, 'm')

overrideAlarmConfig("[default]PT2323/PV", "Hi", "enabled", True)
2 Likes