FreeOpcUa / opcua-asyncio

OPC UA library for python >= 3.7
GNU Lesser General Public License v3.0
1.13k stars 362 forks source link

Cannot create alias for node. #1264

Closed Flock1993 closed 1 year ago

Flock1993 commented 1 year ago

I'm trying to create alias for node. With using of examples.client-minimal.py i make my local OPC UA server with one variable - MyVariable. Variable in UaExpert image I set alias to MyVariable by this code:

async with Client(url="opc.tcp://admin@localhost:4840/freeopcua/server/") as client:
    var = await client.nodes.root.get_child(
        ["0:Objects", f"2:MyObject", f"2:MyVariable"]
    )
    alias = ua.LocalizedText("MB0")
    await var.write_attribute(ua.AttributeIds.DisplayName, ua.DataValue(alias))

After setting alias "MB0" i connect to server by UaExpert. When i use Root -> Objects -> Aliases -> FindAlias call with "MB0" image There is a error: "BadNothingToDo". And this tells me that I created the alias incorrectly. What i am doing wrong and how can i fix alias setting?

schroeder- commented 1 year ago

You have to implement the function "FindAlias" your self. Use link_method todo this.

AndreasHeine commented 1 year ago

you should read this before: https://reference.opcfoundation.org/Core/Part17/v104/docs/

Flock1993 commented 1 year ago

Closing the issue, it was not OPC UA, but OPC DA with fake UA shell.