Skip to content

VariableNode

Canonical path: o6.node.VariableNode

VariableNode

Bases: Node

Node representing an OPC UA Variable.

The call operator defaults to the Value attribute, so node() reads the value and node(23.5) writes it.

The keyword form of the constructor shown below creates a node in a server's address space. It is available on the generated VariableTypes in o6.ns and on @o6.variabletype classes, which is where instances are normally created; calling this base class with those keywords raises TypeError, because a bare Variable has no type definition to instantiate.

Functions

__init__

__init__(
    backend: Any,
    nodeId: NodeIdLike,
    browseName: QualifiedName,
) -> None
__init__(
    *,
    server: Optional[Server] = None,
    nodeId: Optional[NodeIdLike] = None,
    parent: Optional[NodeIdLike | Node] = None,
    browseName: Optional[str | QualifiedName] = None,
    referenceType: Optional[NodeIdLike] = None,
    value: Any = None,
    values: Optional[dict[str, Any]] = None,
    dataType: Any = None,
    valueRank: Optional[int] = None,
    arrayDimensions: Optional[list[int]] = None,
    accessLevel: Optional[int] = None,
    references: Optional[list[Any]] = None
) -> None
__init__(*args, **kwargs)

__call__

__call__(value=_UNSET, attr=None)

Read or write this Variable's value, or another attribute.

Identical to Node.__call__ except that the attribute defaults to Value.

__getitem__

__getitem__(key)

Resolve a browse path relative to this node.

Use this where attribute access cannot reach: a BrowseName that is not a Python identifier, an ambiguous name, or a multi-step relative path.

Parameters:

Name Type Description Default
key str | 'ns0.datatypes.RelativePath'

A relative-path string such as "1:DeviceSet/1:Motor", or a ns0.datatypes.RelativePath.

required

Returns:

Type Description
MaybeAwaitable[list[Any]]

Every node the path resolves to, as a list; awaitable when the owning

MaybeAwaitable[list[Any]]

client or server runs on an external event loop.

Raises:

Type Description
KeyError

The path matches no node.