Write Boolean Tag Error

I’d like to write bool tag by gateway event but sometimes it gives error as below. I have no idea why the error occurred randomly? It sometimes works but sometimes error occurs. Ignition Version: 8.1.13

Gateway Event Script , Three methods were used. The issue can’t be resolved.

system.tag.write(basePath + "/Test", 0)
system.tag.writeAsync([basePath + '/Test'], [0])
system.tag.writeBlocking(basePath + "/Test", 0)

Error Message ,when I use the function => system.tag.writeBlocking(basePath + “/Test”, 0)

java.util.concurrent.TimeoutException: null

at java.base/java.util.concurrent.CompletableFuture.timedGet(Unknown Source)

at java.base/java.util.concurrent.CompletableFuture.get(Unknown Source)

at com.inductiveautomation.ignition.gateway.script.GatewayTagUtilities.writeBlockingImpl(GatewayTagUtilities.java:261)

at com.inductiveautomation.ignition.common.script.builtin.AbstractTagUtilities.writeBlocking(AbstractTagUtilities.java:483)

at jdk.internal.reflect.GeneratedMethodAccessor529.invoke(Unknown Source)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.base/java.lang.reflect.Method.invoke(Unknown Source)

at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:190)

at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.__call__(ScriptManager.java:541)

at org.python.core.PyObject.__call__(PyObject.java:477)

at org.python.core.PyObject.__call__(PyObject.java:481)

at org.python.pycode._pyx25927.f$0(:20)

at org.python.pycode._pyx25927.call_function()

at org.python.core.PyTableCode.call(PyTableCode.java:173)

at org.python.core.PyCode.call(PyCode.java:18)

at org.python.core.Py.runCode(Py.java:1687)

at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:788)

at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$TrackingProjectScriptManager.runCode(ProjectScriptLifecycle.java:693)

at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:740)

at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$TrackingProjectScriptManager.runCode(ProjectScriptLifecycle.java:674)

at com.inductiveautomation.ignition.common.script.TagChangeScriptExecutor$TagChangeExecutionCallback.execute(TagChangeScriptExecutor.java:242)

at com.inductiveautomation.ignition.common.script.TagChangeScriptExecutor$TagChangeExecutionCallback.execute(TagChangeScriptExecutor.java:194)

at com.inductiveautomation.ignition.common.util.SerialExecutionQueue$PollAndExecute.run(SerialExecutionQueue.java:102)

at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

at java.base/java.util.concurrent.FutureTask.run(Unknown Source)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.base/java.lang.Thread.run(Unknown Source)

Tag Security
tagimg

system.tag.write is deprecated in v8+

In your aSync example you use single quotes.

I would suggest you use writeBlocking and follow the example from the user manual for the correct syntax:

# Create a list with the tag paths to be updated.
paths = ["[default]Folder/Tag_A","[default]Folder/Tag_B"]
 
# Create a list with the update values, one value for each path.
values = [1,2]
 
# Execute the write operation.
system.tag.writeBlocking(paths, values)

In your example of writeBlocking you have not included the square brackets around the tag path or values.

1 Like

Timeouts on write can be caused by a device that is bogged down with too many subscription items. Look at the diagnostics for the device to see its current timing and overload statistics.

1 Like