Write JSON string to OPC-UA InputArguments Method

Hi
I’m using “node-red-contrib-opcua” and trying to write a JSON string to an InputArguments methodId with the help of OpcUA-Method node.
I can read data from the corresponding outputArguments method. But I can’t figure out how to write the code in my function node to puch the content of a JSON string to an OPCUA Method.
Below is the script I’m using in my function node to read data (taken from the example from “node-red-contrib-opcua” documentation <link>):

msg.objectId = "ns=2;i=5476";
msg.methodId = "ns=2;i=8106";
return msg;

Anyone that can help me?
Best Regards //Håkan

After som trial and error I manage to find a way how to write a JSON string to and inputArgument method.

F.Y.I. This is the syntax I used in my function node:

var Str = msg.payload

msg.objectId = "ns=2;i=5476";
msg.methodId = "ns=2;i=8080";
msg.methodType = 'basic'

msg.inputArguments = [{ dataType: "String", arrayType: "Scalar", value: Str}];

return msg;
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.