Skip to content

Event subscription #1274

Answered by schroeder-
FShinoda asked this question in Q&A
Apr 8, 2023 · 3 comments · 13 replies
Discussion options

You must be logged in to vote

If you want to get a data change then call subscribe_data_change, events in opc ua is something totally different.
You directly disconnect in your code. This code is what you want:

 async with client: 
        print("#"*25)
        ## Get root node
        root_node = client.get_root_node()
        print("The root node id is:", root_node)
        
        # Subscribe to events on the node
        exam = client.get_node('ns=1; s=BLBSLI403MIFA.pas.valor')
        handler = SubHandler()
        subscription = await client.create_subscription(500, handler)
        await subscription.subscribe_data_change(exam)
        # await subscription.subscribe_events(exam)
        while True:
           …

Replies: 3 comments 13 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
7 replies
@GoetzGoerisch
Comment options

@GoetzGoerisch
Comment options

@FShinoda
Comment options

@schroeder-
Comment options

Answer selected by FShinoda
@FShinoda
Comment options

Comment options

You must be logged in to vote
6 replies
@xyzakdkd
Comment options

@schroeder-
Comment options

@xyzakdkd
Comment options

@schroeder-
Comment options

@xyzakdkd
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants