I would like to set all tags for a device as disabled (Enabled = False) and then re-enable the all those same tags at a later time so that essentially a device can be taken offline (no new tag values being recorded because the customer has the device in a mode where they do not want the values recorded) and then put back online (tag value updates re-enabled).
There may be subfolders and more tags also, so I would want it to be recursive.
Example for one tag at a time:
system.tag.editTag(tagPath=" MyOPCServer /DeviceSet/MyDeviceFolder/MyTag_1", attributes={"Enabled":"False"})
system.tag.editTag(tagPath=" MyOPCServer /DeviceSet/ MyDeviceFolder /MyTag_2", attributes={"Enabled":"False"})
system.tag.editTag(tagPath=" MyOPCServer /DeviceSet/ MyDeviceFolder / MyDeviceSubFolder /MyTag_1", attributes={"Enabled":"False"})
system.tag.editTag(tagPath=" MyOPCServer /DeviceSet/ MyDeviceFolder / MyDeviceSubFolder /MyTag_2", attributes={"Enabled":"False"})
I would like to do an equivalent that would disable all the tags recursively in one statement if possible:
system.tag.editTag(tagPath="MyOPCServer/DeviceSet/ MyDeviceFolder ", attributes={"Enabled":"False"})
I guess I could do something using system.tag.browseTags like:
tags = system.tag.browseTags(parentPath=" MyOPCServer /DeviceSet/ MyDeviceFolder ")
for tag in tags:
# Check for tags where tag.isOPC() is true and disable
# Check for tags where tag.isFolder() is true and do system.tag.browseTags on the subfolder
# etc…
But is there a simpler solution?