Here’s a function you can use instead of system.tag.writeAsync to override properties. It builds the structure in the second code block example in earlier post above, and works for any nesting depth.
# Override a property at variable nesting within a UDT.
# Provide basePath that UDT is in, and path to property from there.
# Property path must contain the property's tag name (i.e. "OVR.enabled", not "enabled").
def tagPropertyOverride(basePath, tagPropertyPath, overrideValue):
names = tagPropertyPath.replace('.','/').split('/')
# Cut property from names.
overrideProperty = names.pop(len(names)-1)
tags = None
# Build structure from deepest nesting level up.
for name in reversed(names):
if tags is None:
# This is the innermost level; include property override.
tags = [{'name':name, overrideProperty:overrideValue}]
else:
# Nest last level inside this one and add name for this level.
tags = [{'name':name, 'tags':tags}]
# Merge this override with existing tag.
system.tag.configure(basePath, tags, 'm')
tagPropertyOverride('[default]DPB', 'PI05051/CMD/OVR.enabled', False)
EDIT: For future readers, if you don’t need the ability to work to various nesting depths for a particular base path, see this post for a simpler solution (direct replacement for tag write) to override a property at a path.