Search code examples
c#node.jswpfopc-ua

Write integer to OPC UA server - “not of the same type” error


I have defined an OPC UA Client

 var client = new OpcClient("opc.tcp://localhost:4840");
 client.Connect();

That works properly and connects to a server that I have also written. Also the client can read

var status = client.WriteNode("ns=2;s=Temperature", 999);

The problem comes out when I want to write a value to the server:

var status = client.WriteNode("ns=2;s=Temperature", 999);

instead I get the error:

"The value supplied for the attribute is not of the same type as the attribute's value."

enter image description here

That link Write Boolean to OPC UA server - "not of the same type" error didn't help.

I used the Opc.UaFx implementation.

Thanks in advance

Patrick


Solution

  • Just add the keyword double:

    var status = client.WriteNode("ns=2;s=Temperature", (double)999);