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.
OPC DA item with an access path
Sorry, that's because I could not test it right now. Use this instead:
Best regards
Please Log in or Create an account to join the conversation.
import opclabs_quickopc
import time
# Import .NET namespaces.
from OpcLabs.EasyOpc import *
from OpcLabs.EasyOpc.DataAccess import *
# Item changed event handler.
def itemChanged(sender, e):
if e.Succeeded:
print(e.Vtq)
else:
print('*** Failure: ', e.ErrorMessageBrief, sep='')
# Instantiate the client object.
client = EasyDAClient()
client.ItemChanged += itemChanged
print('Subscribing item changes...')
# IEasyDAClientExtension.SubscribeItem(client, '', 'OPCLabs.KitServer.2', 'Demo.Ramp', 200)
# Define server, ItemID, and access path
server_name = "MyServer.OPC.1" # Replace with your server's ProgID
item_id = "Time2" # Example ItemID (server-specific)
access_path = "Botch" # Example access path (server-specific)
# Create a DAItemDescriptor with ItemID and access path
item_descriptor = DAItemDescriptor(item_id)
item_descriptor.AccessPath = access_path
client.SubscribeItem(ServerDescriptor('', server_name), item_descriptor, DAGroupParameters(200), None)
print('Processing item change notifications for 30 seconds...')
time.sleep(30)
print('Unsubscribing all items...')
client.UnsubscribeAllItems()
client.ItemChanged -= itemChanged
print('Finished.')
Error being returned is:
client.SubscribeItem(ServerDescriptor('', server_name), item_descriptor, DAGroupParameters(200), None)
AttributeError: 'EasyDAClient' object has no attribute 'SubscribeItem'
Please Log in or Create an account to join the conversation.
In this example, replace the line with
Best regards
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
You have written that you get error on this line:
item_descriptor = DAItemDescriptor(item_id, access_path)
So I am suggesting to replace this line by the code I have posted, i.e.
item_descriptor = DAItemDescriptor(item_id)
item_descriptor.AccessPath = access_path
Regards
Please Log in or Create an account to join the conversation.
Thanks for your patience and assistance.
Please Log in or Create an account to join the conversation.
pip install opclabs_quickopc
and then, in your code, start with
import opclabs_quickopc
# Import .NET namespaces.
from OpcLabs.EasyOpc.DataAccess import *
from OpcLabs.EasyOpc.DataAccess.OperationModel import *
See our Python examples (there are more than 200 of them).
Best regards
Please Log in or Create an account to join the conversation.
I guess I can still be surprised ( by the access path usage ).
In order to specify the access path, you can create the item descriptor like this:
item_descriptor = DAItemDescriptor(item_id)
item_descriptor.AccessPath = access_path
I hope this helps.
Best regards
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
If really needed, I can help with properly specifying the access path. However, I seriously doubt that access path is what you are looking for. I am involved with OPC almost from its beginnings, 25-30 years. And in this whole period, I have *never* seen an actual OPC server that would require or even support access paths. Access paths are esoteric feature that only existed in OPC DA specification 1.0, and has been removed in all subsequent versions of the spec.
I suggest that you rather describe what you want to achieve or why you have asked for the access path. I think that with Matrikon OPC server, the ItemID should be sufficient for the server to identify what you want to read, write, or subscribe to.
Best regards
Please Log in or Create an account to join the conversation.