eta_utility.connectors.node module

This module implements the node class, which is used to parametrize connections

class eta_utility.connectors.node.NodeMeta(name: str, bases: tuple, namespace: dict[str, Any], **kwargs: Any)[source]

Bases: type

Metaclass to define all Node classes as frozen attr dataclasses.

class eta_utility.connectors.node.Node(name: str, url: str, protocol: str, *args: Any, **kwargs: Any)[source]

Bases: object

The node objects represents a single variable. Valid keyword arguments depend on the protocol.

name: str

Name for the node.

url: str

URL of the connection.

url_parsed: ParseResult

Parse result object of the URL (in case more post-processing is required).

protocol: str

Protocol of the connection.

usr: str | None

Username for login to the connection (default: None).

pwd: str | None

Password for login to the connection (default: None).

interval: str | None

Interval

dtype: Callable | None

Data type of the node (for value conversion). Note that strings will be interpreted as utf-8 encoded. If you do not want this behaviour, use ‘bytes’.

classmethod from_dict(dikt: Sequence[Mapping] | Mapping[str, Any], fail: bool = True) list[Node][source]

Create nodes from a dictionary of node configurations. The configuration must specify the following fields for each node:

  • Code (or name), URL, Protocol (i.e. modbus or opcua or eneffco). The URL should be a complete network location identifier. Alternatively it is possible to specify the location in two fields: IP and Port. These should only contain the respective parts (as in only an IP address and only the port number). The IP-Address should always be given without scheme (https://).

For local nodes no additional fields are required.

For Modbus nodes the following additional fields are required:

  • ModbusRegisterType (or mb_register), ModbusSlave (or mb_slave), ModbusChannel (or mb_channel).

For OPC UA nodes the following additional fields are required:

  • Identifier.

For EnEffCo nodes the code field must be present.

For EntsoE nodes the endpoint field must be present.

Parameters:
  • dikt – Configuration dictionary.

  • fail – Set this to false, if you would like to log errors instead of raising them.

Returns:

List of Node objects.

classmethod from_excel(path: Path, sheet_name: str, fail: bool = True) list[Node][source]

Method to read out nodes from an Excel document. The document must specify the following fields:

  • Code, IP, Port, Protocol (modbus or opcua or eneffco).

For Modbus nodes the following additional fields are required:

  • ModbusRegisterType, ModbusByte, ModbusChannel.

For OPC UA nodes the following additional fields are required:

  • Identifier.

For EnEffCo nodes the Code field must be present.

The IP-Address should always be given without scheme (https://).

Parameters:
  • path – Path to Excel document.

  • sheet_name – name of Excel sheet, which will be read out.

  • fail – Set this to false, if you would like to log errors instead of raising them.

Returns:

List of Node objects.

classmethod get_eneffco_nodes_from_codes(code_list: Sequence[str], eneffco_url: str) list[Node][source]

Utility function to retrieve Node objects from a list of EnEffCo Codes (Identifiers).

Deprecated since version v2.0.0: Use the from_ids function of the EnEffCoConnection Class instead.

Parameters:
  • code_list – List of EnEffCo identifiers to create nodes from.

  • eneffco_url – URL to the EnEffCo system.

Returns:

List of EnEffCo nodes.

class eta_utility.connectors.node.NodeLocal(name: str, url: str, protocol: str, *args: Any, **kwargs: Any)[source]

Bases: Node

Local Node (no specific protocol), useful for example to manually provide data to subscription handlers.

name: str

Name for the node.

url: str

URL of the connection.

url_parsed: ParseResult

Parse result object of the URL (in case more post-processing is required).

protocol: str

Protocol of the connection.

usr: str | None

Username for login to the connection (default: None).

pwd: str | None

Password for login to the connection (default: None).

interval: str | None

Interval

dtype: Callable | None

Data type of the node (for value conversion). Note that strings will be interpreted as utf-8 encoded. If you do not want this behaviour, use ‘bytes’.

class eta_utility.connectors.node.NodeModbus(name: str, url: str, protocol: str, *args: Any, **kwargs: Any)[source]

Bases: Node

Node for the Modbus protocol.

mb_slave: int | None

Modbus Slave ID

mb_register: str

Modbus Register name. One of input, discrete_input, coils and holding. Note that only coils and holding can be written to.

mb_channel: int

Modbus Channel (Address of the value)

mb_bit_length: int

Length of the value in bits (default 32). This determines, how much data is read from the server. The value must be a multiple of 16.

mb_byteorder: str

Byteorder of values returned by modbus

class eta_utility.connectors.node.NodeOpcUa(name: str, url: str, protocol: str, *args: Any, **kwargs: Any)[source]

Bases: Node

Node for the OPC UA protocol.

opc_id: str | None

Node ID of the OPC UA Node.

opc_path_str: str | None

Path to the OPC UA node.

opc_ns: int | None

Namespace of the OPC UA Node.

opc_id_type: str

Type of the OPC UA Node ID Specification.

opc_name: str

Name of the OPC UA Node.

opc_path: list[NodeOpcUa]

Path to the OPC UA node in list representation. Nodes in this list can be used to access any parent objects.

class eta_utility.connectors.node.NodeEnEffCo(name: str, url: str, protocol: str, *args: Any, **kwargs: Any)[source]

Bases: Node

Node for the EnEffCo API.

eneffco_code: str

EnEffCo datapoint code / ID.

class eta_utility.connectors.node.NodeEntsoE(name: str, url: str, protocol: str, *args: Any, **kwargs: Any)[source]

Bases: Node

Node for the EntsoE API (see ENTSO-E Transparency Platform API).

Available endpoint

Endpoint

Description

ActualGenerationPerType

Actual Generation Per Energy Type

Price

Price day ahead

Currently, there is only two endpoints available, due to the parameter managing required by the API documentation. The other possible endpoints are listed in

eta_utility.connectors.entso_e._ConnectionConfiguration._doc_types

Main bidding zone

Bidding Zone

Description

DEU-LUX

Deutschland-Luxemburg

The other possible bidding zones are listed in

eta_utility.connectors.entso_e._ConnectionConfiguration._bidding_zones

endpoint: str

REST endpoint.

bidding_zone: str

Bidding zone.

class eta_utility.connectors.node.NodeCumulocity(name: str, url: str, protocol: str, *args: Any, **kwargs: Any)[source]

Bases: Node

Node for the Cumulocity API.

device_id: str
measurement: str
fragment: str