Trigger a memory tag / OPCUA tag for N seconds and turn off

tejas200010
Mon, 24 Nov 2025 09:42:18 +0000
Ignition

Hi, I am working in Ignition Perspective and I want to turn an OPC UA Boolean tag ON only for 2 seconds when a button is pressed, and then turn it OFF automatically.

I wrote this script under Button → onActionPerformed → runAction:

def runAction(self, event):
tagPath = "[default]MyFolder/MyPulseTag"

def pulseTag():
    import time
    system.tag.writeBlocking([tagPath], [True])
    time.sleep(2)
    system.tag.writeBlocking([tagPath], [False])

system.util.invokeAsynchronous(pulseTag)

This is working fine.

My main doubts are:

1. Is this approach safe and recommended?

2. Does invokeAsynchronous() ensure that the UI/session thread is not blocked during the time.sleep(2)?

3. Is there a better way to create a 2-second pulse on a tag?

Thanks in advance.

7 posts - 4 participants