How to Implement Event Filter in event subscription #1498
-
I am developing client and trying to subscribe event with event filter option obj = await client.nodes.root.get_child(["0:Objects", "2:MyObject"]) handle = await self.subscription.subscribe_events(obj, myevent, evfilter) Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can import the 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])
https://reference.opcfoundation.org/v105/Core/docs/Part4/7.22.3 You can then delete some of the
handle = await self.subscription.subscribe_events(obj, myevent, event_filter) Or directly create the event_filter object with the |
Beta Was this translation helpful? Give feedback.
You can import the
get_filter_from_event_type
function from events.py:event_filter
is anasyncua.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.Or direct…