eta_utility.servers.opc_ua module

class eta_utility.servers.opc_ua.OpcUaServer(namespace: str | int, ip: str | None = None, port: int = 4840)[source]

Bases: object

Provides an OPC UA server with a number of specified nodes. Each node can contain single values or arrays.

Parameters:
  • namespace – Namespace of the OPC UA Server.

  • ip – IP Address to listen on (default: None).

  • port – Port to listen on (default: 4840).

url: str

URL of the OPC UA Server.

idx: int

idx: Namespace of the OPC UA _server

write(values: Mapping[NodeOpcUa, Any]) None[source]

Write some values directly to the OPC UA server.

Parameters:

values – Dictionary of data to write {node.name: value}.

read(nodes: Nodes[NodeOpcUa] | None = None) pd.DataFrame[source]

Read some manually selected values directly from the OPC UA server.

Parameters:

nodes – List of nodes to read from.

Returns:

pandas.DataFrame containing current values of the OPC UA-variables.

Raises:

RuntimeError – When an error occurs during reading.

create_nodes(nodes: Nodes[NodeOpcUa]) None[source]

Create nodes on the server from a list of nodes. This will try to create the entire node path.

Parameters:

nodes – List or set of nodes to create.

delete_nodes(nodes: Nodes[NodeOpcUa]) None[source]

Delete the given nodes and their parents (if the parents do not have other children).

Parameters:

nodes – List or set of nodes to be deleted.

start() None[source]

Restart the server after it was stopped.

stop() None[source]

This should always be called, when the server is not needed anymore. It stops the server.

property active: bool
allow_remote_admin(allow: bool) None[source]

Allow remote administration of the server.

Parameters:

allow – Set to true to enable remote administration of the server.