Skip to content

How to get node value #1541

@rapid-18

Description

@rapid-18

I try to aceess node value but exception "The access level does not allow reading or subscribing to the Node."(BadNotReadable) is reported.It's quite simple in C# but I don't know how to do it with python-opcua
the code(which is quite simple but still reports error) is below:

from opcua import client as OpcUaClient
class OpcUaClass():
    def __init__(self, url:str):
        self.url = url
        self.Client = OpcUaClient.client.Client(url=self.url,timeout=1)
        self.Client.session_timeout = 100000
        try:
            self.Client.connect()
            node = self.Client.get_node("ns=2;s=/Channel/MachineAxis/aaIm[2]")
            try:
                data = node.get_value()
                print(data)
            except Exception as e:
                print(e)
            self.Client.disconnect()
        except Exception as e:
            print(e)
if __name__ == "__main__":
    client = OpcUaClass(url="opc.tcp://192.168.100.1:4840")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions