Sending Structs via OPC UA to an MQTT Sink in IIoTConnector

Hello Community!

I have a few variables defined as structs in Automation Studio (currently still v4.12) that I’d like to save in a database. To do this, I send them via OPC UA and use IIoTConnector (v1.1.15) to read the values and send them to an MQTT broker.

When I select the individual variables within the structs as nodes to read, rather than the complete structs, everything works fine. I get the variable name and the expected value in the MQTT message.
My problem occurs when I select a struct itself as a node to read. In this case, I only get “<Type index: 21>” as the value (and “dataType: 22”) in the MQTT message, instead of all the name/value pairs that should be part of the struct.

My guess is that this has something to do with how IIoTConnector handles the data. When I view the same struct in UA Expert, the data type is shown as the struct name, and the value contains a list of all the variable names and values that are part of the struct. Even if the struct contains another struct, UA Expert displays this correctly.
So, I assume the struct is being sent correctly by the OPC UA server and that the type definitions are being exported correctly as well.

I’m not sure if the OPC UA Read task simply cannot handle structs, or if the MQTT Sync task fails to write the struct values correctly into the MQTT message.
Is there any way to make this work, or is this simply a limitation of IIoTConnector?

Thanks in advance for any advice you can give me!

Maybe I’m completely wrong, but what OPC UA information model have you configured in the AS project? Are you using V2.0? B&R Online Help

Yes, I’m using 2.0.
I also made sure to switch on the generation of OPC UA type definitions and export the data types in the information model, just in case that might help, though, I don’t think those options made any difference for me. :smiley:

Hi @bblank , I am able to replicate the same behavior as you on my local system:

UaExpert

Value = {“Red”: 50, “Green”: 60, “Blue”: 30} (expected)

IIoT Connector (OPC UA Read + MQTT SINK)

Value = “<Type index: 21>” (unexpected)

dataType = 22 (equivalent to OPC UA standard type: ExtensionObject)

I also tried it with OPC UA Subscribe and got essentially the same result (the only difference was that “dataType” was explicitly shown as “OPC_UA_DATA_TYPE_EXTENSION_OBJECT”, which is the same as the integer value 22 that returned from the OPC UA Read):

Looking into the IIoT Connector User’s Manual v1.2.0 ( B&R IIoT Connector User's Manual | B&R Industrial Automation ), I found the below note on Page 47:

image

This effectively means that the behavior you are experiencing is expected since reading structures and arrays via OPC UA are currently not fully supported in the IIoT Connector. While I currently do not see this on the IIoT Connector roadmap, I will double-check internally and see if I can find out if/when this feature extension will be provided. I will follow up here once I have more information.

In the meantime, please configure the OPC UA Read task to read each node individually as you mentioned you are already doing as a workaround.

Thank you so much! Now at least I know there is nothing more I can do at this point, so I’ll just read the variables individually and in the future I might change to handling the whole structs when and if that is supported.

Hi @bblank , following up on this, I have received confirmation that there are currently no plans to add this feature to the IIoT Connector. The recommended approach is to read structure members individually.

If this is an important feature/use case for your customer, please get in touch with your B&R Sales Representative and they can help you submit this as a feature request.