Right, so when i find the tag i want, i managed to “pop” the overridden property out of the JSON dict.
But when i try use that in the system.tag.configure again, i get that annoying bug where a bunch of other properties are now overridden that weren’t before.
I think this was addressed in another forum thread where someone said you had to strip out everything except for stuff you DO want overridden.
Do i need to go back to that method where you have to compare the original UDT config with the current tag instance config, and figure out what is different etc… etc… ?
In a lot of cases you just want to change a particular property, and leave the rest alone.
Its maddening how difficult that is at first glance.
For example:
tagPath = "[default]temp/testOverrides/IL23013"
# Set the override such that the "Out" child tag is set to readOnly = True
# Default for UDT is readOnly = False
overrides = [{"name":"Out", "readOnly":True}]
print system.tag.configure(tagPath,overrides,"m")
# Try and remove that specific override ONLY..
tagConfig = system.tag.getConfiguration(basePath=tagPath + '/Out',recursive=False)
## NOTE: print tagConfig provides the following:
# The only actually overridden property is readOnly at this point... I've checked
[{u'tagGroup': u'Direct_Realtime', u'historyEnabled': True, u'engLow': -0.5, u'historicalDeadband': 0.1, u'dataType': Boolean, u'historicalDeadbandStyle': Discrete, u'tooltip': {bindType=parameter, binding={Description} Out Rqst}, u'sampleMode': TagGroup, u'writePermissions': {"type":"AllOf","securityLevels":[]}, u'readOnly': True, u'enabled': True, u'historyProvider': u'Splitter', u'path': [default]temp/testOverrides/IL23013/Out, u'readPermissions': {"type":"AllOf","securityLevels":[]}, u'opcItemPath': {bindType=parameter, binding=ns=1;s=[{Device}]{Tag Name}.Out}, u'historyTagGroup': u'Default Historical', u'historyMaxAgeUnits': HOUR, u'tagType': AtomicTag, u'engHigh': 1.5, u'name': u'Out', u'opcServer': {bindType=parameter, binding={OPC Server}}, u'valueSource': u'opc', u'historyMaxAge': 3}]
# Remove readOnly override with 'pop' function
tagConfig[0].pop('readOnly')
# Try write config back to original tag
print system.tag.configure(basePath=tagPath, tags=tagConfig[0], collisionPolicy="m")
This results in everything listed in the output of the tagConfig being overriden.
EDIT: managed to remove all overrides by pretty much deleting all config except name:
tagConfig[0] = {'name':'Out'}
print system.tag.configure(basePath=tagPath, tags=tagConfig[0], collisionPolicy="o")
So i suppose the glaring question is why does the config return all these things when they aren’t actually overridden to begin with?