Skip to content

How to Implement Event Filter in event subscription #1498

Answered by kevinPolo
arunkumar790 asked this question in Q&A
Discussion options

You must be logged in to vote

You can import the get_filter_from_event_type function from events.py:

from asyncua.common.events import get_filter_from_event_type
...
myevent = await client.nodes.root.get_child(["0:Types", "0:EventTypes", "0:BaseEventType", "2:MyEvent"])
event_filter = await get_filter_from_event_type([myevent])

event_filter is an asyncua.ua.EventFilter object with 'Select' clauses and 'Where' clauses:

https://reference.opcfoundation.org/v105/Core/docs/Part4/7.22.3

You can then delete some of the Select clauses and subscribe with this reduced filter.

perform deletion by comparing the browse path or something else..
handle = await self.subscription.subscribe_events(obj, myevent, event_filter)

Or direct…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@arunkumar790
Comment options

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