1

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

Daniel Widdis
  • 8,424
  • 13
  • 41
  • 63
Patrick
  • 3,073
  • 2
  • 22
  • 60

1 Answers1

2

Just add the keyword double:

var status = client.WriteNode("ns=2;s=Temperature", (double)999);
Luca
  • 918
  • 2
  • 13
  • 30