Closed dammen closed 1 year ago
Thanks for reporting, that was a plain "off by 1" bug. I've just checked in a fix. :-)
Thanks for the quick reply. I see that you have changed the condition check, but I belive you need to change the indexing of the parts-array instead. At least in our case the first element is endpointUrl, second is DisplayName and the third element is the node id. For example: ["opc.tcp://111.111.11.111:1111_11111111_somename", "sensor-name", "i=11111"]. Thus to get the correct properties in the digital twin we needed to rewrite the code as following:
if (parts.Length > 1)
{
updateTwinData.AppendReplace("/OPCUADisplayName", parts[1]);
}
if (parts.Length > 2)
{
updateTwinData.AppendReplace("/OPCUANodeId", parts[0] + parts[2]);
}
Edit: I have a branch with the changes applied, but I dont have permission to push to the repo. If you give me access, then I can create a pull request for the issue. There is also some other problems we have encountered which I then also could add PR for.
OK, I see what the problem is. You are setting the name property in the metadata message to the EndpointUrl of your OPC UA server, while UA Cloud Twin expects OPCUAApplicationURI;OPCUANamespaceURI. The EndpointURL of an OPC UA server is not globally unique while the combination of OPCUAApplicationURI;OPCUANamespaceURI is. Please modify our OPC UA Publisher accordingly.
I've added a section in the readme explaining all this stuff. :-)
okay, then it makes sense. Thanks for clarifying this!
Closing as the issue was resolved.
https://github.com/digitaltwinconsortium/UA-CloudTwin/blob/420384cddc93a8c9e09c93015126bc431198ba31/Applications/ADTClient.cs#L264
When running locally the ADTClient gets an index out of range error on line 264. After inspecting the array, it seems that you have written the code for 1-based indexed arrays.
Are my assumption correct ? And if so, is there a particular reason for this ?
If not, is there anything wrong with the telemetryName that is passed into the function:
"opc.tcp://111.111.11.111:1111_11111111_somename;sensor-name;i=11111"