Well, what I said wasn’t the error, got past that a few days ago, that’s what I get for putting this down a few days
Anyway, the error is this:
> Error in Step 'Action' in chart 'a6bea3af-834b-43ba-942e-ff3b9b406a20' for station 'Test-OP005 Traceback (most recent call last):
> File "<Script name="">", line 16, in onStart
> File "<module:sit.telegrams.actions>", line 180, in run
> File "<module:sit.telegrams.util>", line 38, in tag_subscribe
> AttributeError: 'com.inductiveautomation.ignition.gateway.tags.mode' object has no attribute 'subscribe'
So, IgnitionGateway is found. The original developer had this method to make the subscription:
So reporting back, IgnitionGateway does of course work and instead of .subscribe, .subscribeAsync should be used. There are two overloads of subscribeAsync, the one taking one path and one listener must be private because it is not recognized, so I used the list version that has the two “list” parameters required (list of tags, list of listeners).
The TagChangeListener I used is from com.inductiveautomation.ignition.common.tags.model.event … like this
from com.inductiveautomation.ignition.common.tags.model.event import TagChangeListener
Here is the top portion of my handler
def __init__(self, parent):
self.__parent = parent
def tagChanged(self, event):
objValue = event.getValue()
value = objValue.getValue()
Notice above I’ve broken out to values … objValue represents an object with multiple properties, one of which is value. To get “the value” of the tag, call get getValue() on the the event object value.
I sure hope you are keeping track of these (this?) listeners with the system.util.getGlobals() dictionary – otherwise you will be attaching code to platform objects that will survive code edits and will leak jython interpreters along the way. See this discussion: