FreeOpcUa / python-opcua

LGPL Pure Python OPC-UA Client and Server
http://freeopcua.github.io/
GNU Lesser General Public License v3.0
1.36k stars 658 forks source link

subscribe_events error: BadMonitoredItemFilterInvalid #546

Open XieYiC opened 6 years ago

XieYiC commented 6 years ago

hi,: I try to subscribe events from opc ua server, and get the following error message: " The monitored item filter parameter is not valid.(BadMonitoredItemFilterInvalid). " and my client could not recieve any event from server.
I would be glad, if someone could take the time to give me a short explanation of that.

Example code:

if name == "main": logging.basicConfig(level=logging.WARN) logger = logging.getLogger("KeepAlive") logger.setLevel(logging.DEBUG) client = Client("opc.tcp://localhost:8082/test1/server/")

client = Client("opc.tcp://admin@localhost:4840/freeopcua/server/") #connect using a user

try:
    client.connect()
    handler = SubHandler()
    myvar = client.get_node("ns=1;s=t|opc_ua_3")
    myvar1 = client.get_node("ns=1;s=t|opc_ua_2")
    sub = client.create_subscription(0, handler)
    handle = sub.subscribe_data_change([myvar, myvar1])
    time.sleep(1)
    sub.subscribe_events()
except Exception as e:
    print e
ts4iot commented 1 year ago

Hi, I have the same problem, do you find a solution for your problem?