Hey, given some condition I want to periodically update a few OPC tags. To accomplish this, I've attempted to pull the current tag configuration with system.tag.getConfiguration(tagPath, False)
and make those changes. Afterwards, I write that new configuration back to the tag with system.tag.configure(tagPath, tagConfig)
.
The problem I'm having is that this overwrites the parts of the tag I do not get from .getConfiguration()
. Specifically, the eventScripts are not included and are therefore being overwritten when using .configure()
. This results in the loss of the event scripts associated with the tags.
To illustrate, I start with this:
{
"eventScripts": [
{
"eventid": "valueChanged",
"script": "\tscript()"
}
],
"valueSource": "opc",
"opcItemPath": "tagPath",
"dataType": "Boolean",
"name": "name",
"value": false,
"tagType": "AtomicTag",
"opcServer": "server"
}
and end up with this:
{
"valueSource": "opc",
"opcItemPath": "tagPath",
"dataType": "Boolean",
"name": "name",
"tagType": "AtomicTag",
"opcServer": "server"
}
I was wondering if anyone has encountered a similar issue or has insights on how to update tag configurations without losing the event scripts. Any advice or suggestions would be greatly appreciated!