I am trying to figure out why my invokeAsynchronous works on the tag browser but not on the gateway even thou they are similar logic.
On tag browser:
def valueChanged(tag, tagPath, previousValue, currentValue, initialChange, missedEvents):
if not initialChange and currentValue.value:
def foo():
import time
for i in range(300):
if not system.tag.readBlocking("[default]S/C/S")[0].value:
return
time.sleep(1)
system.tag.writeBlocking("[default]S/C/D", True)
system.util.invokeAsynchronous(lambda:foo())
This works and sets D true after 5 minutes.
On gateway tag change script:
if not initialChange:
if event.currentValue.value:
def foo():
import time
for i in range(300):
if not system.tag.readBlocking("[default]S/C/S")[0].value:
return
time.sleep(1)
system.tag.writeBlocking("[default]S/C/D", True)
system.util.invokeAsynchronous(lambda:foo())
I do enter into the code, however foo never gets called. So D never gets set.
What makes these 2 places different that caused one to work and the other not?