Online Forums
Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.
Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.
Do not use the Contact page for technical issues.
SubscribeMultiple Example using Python
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
here it is:
# This example shows how to subscribe to changes of multiple monitored items, pull events, and display each change.
import time
import win32com.client
# Instantiate the client object
client = win32com.client.Dispatch('OpcLabs.EasyOpc.UA.EasyUAClient')
# In order to use event pull, you must set a non-zero queue capacity upfront.
client.PullDataChangeNotificationQueueCapacity = 1000
print('Subscribing...')
monitoringParameters = win32com.client.Dispatch('OpcLabs.EasyOpc.UA.UAMonitoringParameters')
monitoringParameters.SamplingInterval = 1000
monitoredItemArguments1 = win32com.client.Dispatch('OpcLabs.EasyOpc.UA.OperationModel.EasyUAMonitoredItemArguments')
monitoredItemArguments1.EndpointDescriptor.UrlString = 'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer'
monitoredItemArguments1.NodeDescriptor.NodeId.ExpandedText = 'nsu=http://test.org/UA/Data/ ;i=10845'
monitoredItemArguments1.MonitoringParameters = monitoringParameters
monitoredItemArguments2 = win32com.client.Dispatch('OpcLabs.EasyOpc.UA.OperationModel.EasyUAMonitoredItemArguments')
monitoredItemArguments2.EndpointDescriptor.UrlString = 'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer'
monitoredItemArguments2.NodeDescriptor.NodeId.ExpandedText = 'nsu=http://test.org/UA/Data/ ;i=10853'
monitoredItemArguments2.MonitoringParameters = monitoringParameters
monitoredItemArguments3 = win32com.client.Dispatch('OpcLabs.EasyOpc.UA.OperationModel.EasyUAMonitoredItemArguments')
monitoredItemArguments3.EndpointDescriptor.UrlString = 'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer'
monitoredItemArguments3.NodeDescriptor.NodeId.ExpandedText = 'nsu=http://test.org/UA/Data/ ;i=10855'
monitoredItemArguments3.MonitoringParameters = monitoringParameters
arguments = [
monitoredItemArguments1,
monitoredItemArguments2,
monitoredItemArguments3
]
client.SubscribeMultipleMonitoredItems(arguments)
print('Processing data change events for 1 minute...')
endTime = time.time() + 60
while time.time() < endTime:
eventArgs = client.PullDataChangeNotification(2*1000)
if eventArgs is not None:
# Handle the notification event
print(eventArgs)
Best regards
Please Log in or Create an account to join the conversation.
Thank you for getting back to me so Promptly. The customer is working on an OPC UA Client application. My apologies for not sharing this with you in my initial message.
Best regards,
John G.
Please Log in or Create an account to join the conversation.
is this meant for OPC UA, or for OPC Classic?
(I do not have either example, but will try to put it together tomorrow)
Best regards
Please Log in or Create an account to join the conversation.
I have a customer that is working on a client application using Python. The customer is requesting an example of "Subscribe to Multiple".
Our team's knowledge of the python language is very limited and from experience, we have not come across much use from customers.
Our question to you is, do you happen to have any example code for "Subscribe to Multiple" using python?
Your guidance is greatly appreciated.
Best regards,
John G.
Please Log in or Create an account to join the conversation.