Is there a way to import / export tag group settings via scripting?
I want to add these settings to an automated tag import/export when using a git workflow - they are easily forgotten when setting up a project.
In the designer there is a possibility to import and export these settings to a JSON file, however I can not find any commands in the scripting library. (e.g. Like system.tag.exportTags).
Are they somehow accessible through the SDK? E.g.with TagProvider.getTagGroupsAsync()?
Or is there an easier way to directly trigger a JSON export / import?
I managed to build a simple export / import function using the SDK.
We can get the individual tag group configs and serialize them into a file. For the import they can be deserialized and loaded back to the tag providers.
However I am aware that this is not supported and might cause problems with future versions.
Thank you, having an officially supported way to achieve this would be really helpful.
Here is the export code as an example:
(if anyone wants to build something similar, do not forget to add proper error handling)
from com.inductiveautomation.ignition.gateway import IgnitionGateway
from com.inductiveautomation.ignition.common.tags.config import TagGroupConfiguration
from java.io import ObjectOutputStream, FileOutputStream
EXPORT_PATH = "C://yourpath/"
EXPORT_FILENAME = "TagGroupExport.txt"
logger = system.util.getLogger("myLogger")
context = IgnitionGateway.get()
tagManager = context.getTagManager()
providerNames = tagManager.getTagProviderNames()
logger.info("Provider Names " + str(providerNames))
for name in providerNames:
provider = tagManager.getTagProvider(name)
tagGroupsConfig = provider.getTagGroupsAsync().get()
logger.info("Exported TagGroups: " + str(tagGroupsConfig))
f=FileOutputStream(EXPORT_PATH + name + EXPORT_FILENAME)
o = ObjectOutputStream(f)
logger.info("Tag Groups " + name + " Exported")