Subscription Class

class opcua.common.subscription.Subscription(server, params, handler)[source]

Subscription object returned by Server or Client objects. The object represent a subscription to an opc-ua server. This is a high level class, especially subscribe_data_change and subscribe_events methods. If more control is necessary look at code and/or use create_monitored_items method.


low level method to have full control over subscription parameters Client handle must be unique since it will be used as key for internal registration of data

deadband_monitor(var, deadband_val, deadbandtype=1, queuesize=0, attr=<AttributeIds.Value: 13>)[source]

Method to create a subscription with a Deadband Value. Default deadband value type is absolute. Return a handle which can be used to unsubscribe :param var: Variable to which you want to subscribe :param deadband_val: Absolute float value :param deadbandtype: Default value is 1 (absolute), change to 2 for percentage deadband :param queuesize: Wanted queue size, default is 1


Delete subscription on server. This is automatically done by Client and Server classes on exit

modify_monitored_item(handle, new_samp_time, new_queuesize=0, mod_filter_val=-1)[source]

Modify a monitored item. :param handle: Handle returned when originally subscribing :param new_samp_time: New wanted sample time :param new_queuesize: New wanted queuesize, default is 0 :param mod_filter_val: New deadband filter value :return: Return a Modify Monitored Item Result

subscribe_data_change(nodes, attr=<AttributeIds.Value: 13>, queuesize=0)[source]

Subscribe for data change events for a node or list of nodes. default attribute is Value. Return a handle which can be used to unsubscribe If more control is necessary use create_monitored_items method

subscribe_events(sourcenode=2253, evtypes=2041, evfilter=None, queuesize=0)[source]

Subscribe to events from a node. Default node is Server node. In most servers the server node is the only one you can subscribe to. if evtypes is not provided, evtype defaults to BaseEventType if evtypes is a list or tuple of custom event types, the events will be filtered to the supplied types Return a handle which can be used to unsubscribe


unsubscribe to datachange or events using the handle returned while subscribing if you delete subscription, you do not need to unsubscribe