2

I've searched for hours how to change the nodeid of my objects/variables in freeopcua, but unfortunately can't figure it out.

Can someone with more experience help me out here please?

Mr Pickel
  • 95
  • 10
  • It is a bit hard to follow this question, but it covers exactly what I was looking for. Based on the examples of the library you only get numeric node IDs and I wanted to have a string identifier instead, which basically is the actual question, here. – Chris Tophski Apr 25 '20 at 21:39

1 Answers1

2

Should someone face the same problem - the answer is: While you creating a variable inside a object you can change a nodeid as follows:

myvar = myobj.add_variable("ns=22; s=whatYouWantToCallYourID", "NameOfYourVariable", 0)

Where ns=22 is a namespace of 22 (just for example) and s=whatYouWantToCallYourID the string name of the NodeID. 0 is the initial value of your variable that is beeing created with the above code.

Mr Pickel
  • 95
  • 10
  • 1
    Thanks for sharing your solution. This worked for me as well and I haven't found this hint anywhere else in the docs or whatnot. – Chris Tophski Apr 25 '20 at 21:40