Showing results for 
Search instead for 
Did you mean: 

Read OPCUA structure through datalayer

Read OPCUA structure through datalayer

New Poster

Hello all, I'm Marco.

I'm facing an issue reading a structure of bool in a siemens DB.

I created an opcua client in ctrlX witch connect to opcua server of siemens 1500 and I'm trying to read this structure from datalayer.

I'm using python 3.9 with package ctrlx-datalayer=2.2.0.

Below a snippet of the code I'm using, the response is at right of the print.



with ctrlxdatalayer.system.System('') as dlsystem:
    client: ctrlxdatalayer.client.Client
    client, conn_string = get_client(dlsystem, '')

    res, var = client.read_sync(f'opcuaclient/siemens1/i=85/ns=3;s=PLC/ns=3;s=DataBlocksGlobal/ns=3;s="DB_test2"/ns=3;s="DB_test2"."a0"')
    r = var.get_data()
    print(res, r)  # Result.FAILED bytearray(b'\x10\x00\x00\x00\x00\x00\n\x00\x10\x00\x0c\x00\x08\x00\x04\x00\n\x00\x00\x00\x0c\x00\x00\x00\x00\x00\r\x80\x01\x02\n\rS\x00\x00\x00The operation could not complete because the client is not connected to the server.\x00')



Here the structure.



I have no issue when I read simpler data types.

I encountered the same problem using node-red.

Thank you, I remain available for any clarification.


Community Moderator
Community Moderator

Hi Marco, 

I'm sorry, but could you explain your problem once again? I'm not sure if I understood it correctly. 

Can you see the nodes you are trying to read already in the Data Layer? If so, which Data Types do the nodes have in the Data Layer?

Maybe this document can help you: ctrlX CORE Application Manual (chapter: Data Layer -> Data types -> Introduction and overview)

Here you can see all the supported data types of the ctrlX Data Layer and how the respective data types in the different programming language.

Best regards, 


Hi, thank you for the reply.

Yes I'm able to see all the tree of client in datalayer page.

The type of node that I'm trying to read is a struct of 1024 bool like the image above (image taken from uaexpert tree). So would like to read the struct instead of all single bool.

I tried some method to get the value of node: get_data, get_flatbuffers.. but any of them work. Infact the nearest type of struct is complex-data-type but it doesn't works.

Sometimes get_data returns me a bytearray, but it's complex to manage when the struct form is different from this one.


At the moment only flatbuffer data can be read as structure. Other elements need to be read as single nodes.