I am trying to use the action "method" with OPC UA Client node to call a method, instead of using the OPC UA Method node. In my function node that is connected to the OPC UA Client node I have tried the following code:
After checking the code behind the node https://github.com/mikakaraila/node-red-contrib-opcua/blob/master/opcua/102-opcuaclient.js make me think this parameters should be enough to work:
933 async function callMethod(msg) {
934 if (msg.methodId && msg.inputArguments) {
935 verbose_log("Calling method: " + JSON.stringify(msg.methodId));
936 verbose_log("InputArguments: " + JSON.stringify(msg.inputArguments));
937 verbose_log("OutputArguments: " + JSON.stringify(msg.outputArguments));
I have also tried adding the ObjectNodeId in msg.topic or in msg.nodeId, but with no luck. I am still getting messages like: "Execute method result, error:The node id refers to a node that does not exist in the server address space." or "OPCUA Client to Call Method: can't work without OPC UA NodeId - msg.topic empty" when not using the msg.topic.
Any ideas of what I am doing wrong here?
Hi,
I am trying to use the action "method" with OPC UA Client node to call a method, instead of using the OPC UA Method node. In my function node that is connected to the OPC UA Client node I have tried the following code:
msg.action = "method"; msg.methodId = "ns=4;s=Demo.SetSimulationSpeed"; msg.inputArguments = [{ "dataType": "UInt32", "value": 25 }]; return msg;
After checking the code behind the node https://github.com/mikakaraila/node-red-contrib-opcua/blob/master/opcua/102-opcuaclient.js make me think this parameters should be enough to work: 933 async function callMethod(msg) { 934 if (msg.methodId && msg.inputArguments) { 935 verbose_log("Calling method: " + JSON.stringify(msg.methodId)); 936 verbose_log("InputArguments: " + JSON.stringify(msg.inputArguments)); 937 verbose_log("OutputArguments: " + JSON.stringify(msg.outputArguments));
I have also tried adding the ObjectNodeId in msg.topic or in msg.nodeId, but with no luck. I am still getting messages like: "Execute method result, error:The node id refers to a node that does not exist in the server address space." or "OPCUA Client to Call Method: can't work without OPC UA NodeId - msg.topic empty" when not using the msg.topic. Any ideas of what I am doing wrong here?
Thanks in advance.