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

I don’t know how to thank you. You save me. What a clever idea.
:pray::pray::pray::pray::pray::pray::pray:

The system.tag.writeAsync() does work only if the key is exist in tag struct. Because Ignition doesn’t include any properties that use default value from it’s UDT, so the property doesn’t exist and system.tag.writeAsync() doesn’t work. The override cause that key, value include in tag struct and after that system.tag.writeAsync().
Do you believe this is a bug? In v7.9 the system.tag.write() did work.

1 Like

The inability to write to (rather than configure) default properties does sound like a bug–or at least a loss of capability–caused by the changes to the tag system.

1 Like

Hi witman
Could you please modify your function so I can toggle alarms enable of a tag.
For example I have udt : PT2323/PV
The PV/Alarms/Hi.enable
The /Alarms/Hi.enable is not path so the your function will not work.
I used to toggle alarm enable with system.tag.wrtie(“PT2323/PV/Alarms/Hi.enable”, True) in v7.9 but as before it doesn’t work in v8.

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

It looks like the inability to write to these may be resolved in 8.0.12 (I haven't tested):

1 Like

I’ve been combing through these threads searching for a way to disable an override for only a single property of a udt tag instnace. I have some tags that have their opcItemPath overridden, and I want to disable the override for that propety only, while keeping some others overridden.

tag = {
'name':tagname,
'overrides': {'opcItemPath':None}
}	

system.tag.configure(cfg_tag_path, [tag], 'o')

The code above disables all override of my instance tag, and also creates a custom object within my instance tag: overrides = {’‘opcItemPath’:None}

@tmahaffey @witman

Found this thread from searching around, trying to do the same thing.

Have you (or anyone) ever found a solution? I get the exact same behavior as you.

'overrides': {'Enabled':None} })

The syntax you guys shared does remove override, but also creates a custom property leftover.

This will remove an override, but unfortunately turns all the non-overridden values included in system.tag.getConfiguration into overrides. Supply a tag path in place of tagPath.

# Get tag config.
cfg = system.tag.getConfiguration(tagPath)[0]
# Remove opcItemPath key.
cfg.pop('opcItemPath', None)
# Get base path.
basePath = tagPath.rsplit("/",1)[0]
# Overwrite tag with cfg that we removed key from.
system.tag.configure(basePath, cfg, 'o')

If system.tag.getConfiguration didn’t return non-overridden values, the above would work without adding overrides.

If you want to remove all overrides from a tag, this works (supply a tag path in place of tagPath):

basePath, name = tagPath.rsplit("/", 1)
cfg = {'name': name}
system.tag.configure(basePath, cfg, 'o')
2 Likes

Has anyone figured out how to remove overrides for just certain tag properties and not the entire tag using scripting? Is that possible?

I haven’t tried and there might be an easier way I’m not aware of, but… I expect this could be done by comparing the UDT instance with the UDT template and removing the override node as well as nodes that weren’t overridden from template but will turn into overrides if you write them back with system.tag.configure. Unless I’m missing something, system.tag.getConfiguration really should not return non-overridden values from UDTs. That would make this easy and the code in my previous post would accomplish what you’re looking for.