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.
- url_parsed: ParseResult
Parse result object of the URL (in case more post-processing is required).
- 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.
- 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_register: str
Modbus Register name. One of input, discrete_input, coils and holding. Note that only coils and holding can be written to.
- 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.
- class eta_utility.connectors.node.NodeEnEffCo(name: str, url: str, protocol: str, *args: Any, **kwargs: Any)[source]
Bases:
Node
Node for the EnEffCo API.
- 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
- class eta_utility.connectors.node.NodeCumulocity(name: str, url: str, protocol: str, *args: Any, **kwargs: Any)[source]
Bases:
Node
Node for the Cumulocity API.
- class eta_utility.connectors.node.NodeWetterdienst(name: str, url: str, protocol: str, *args: Any, **kwargs: Any)[source]
Bases:
Node
Basic Node for the Wetterdienst API. This class is not meant to be used directly, but to be subclassed by NodeWetterdienstObservation and NodeWetterdienstPrediction.
- class eta_utility.connectors.node.NodeWetterdienstObservation(name: str, url: str, protocol: str, *args: Any, **kwargs: Any)[source]
Bases:
NodeWetterdienst
Node for the Wetterdienst API to get weather observations. For more information see: https://wetterdienst.readthedocs.io/en/latest/data/coverage/dwd/observation.html
- class eta_utility.connectors.node.NodeWetterdienstPrediction(name: str, url: str, protocol: str, *args: Any, **kwargs: Any)[source]
Bases:
NodeWetterdienst
Node for the Wetterdienst API to get weather predictions. For more information see: https://wetterdienst.readthedocs.io/en/latest/data/coverage/dwd/mosmix.html
- class eta_utility.connectors.node.NodeEmonio(name: str, url: str, protocol: str, *args: Any, **kwargs: Any)[source]
Bases:
Node
Node for the emonio. The parameter to read is specified by the name of the node. Available parameters are defined in the parameter_map class attribute. Additionally, the phase of the parameter can be specified, with ‘a’, ‘b’, ‘c’ or ‘abc’.
https://wiki.emonio.de/de/Emonio_P3
- parameter_map = {0: ['VRMS', 'V_RMS', 'Voltage', 'V', 'Spannung'], 2: ['IRMS', 'I_RMS', 'Current', 'I', 'Strom'], 4: ['WATT', 'Power', 'W', 'Leistung', 'Wirkleistung'], 6: ['VAR', 'Reactive Power', 'VAR', 'Blindleistung'], 8: ['VA', 'Apparent Power', 'VA', 'Scheinleistung'], 10: ['FREQ', 'Frequency', 'Hz', 'Frequenz'], 12: ['KWH', 'Energy', 'kWh', 'Energie'], 14: ['PF', 'Power Factor', 'PF', 'Leistungsfaktor'], 20: ['VRMS MIN', 'VRMS_MIN', 'Voltage Min', 'V Min', 'Spannung Min'], 22: ['VRMS MAX', 'VRMS_MAX', 'Voltage Max', 'V Max', 'Spannung Max'], 24: ['IRMS MIN', 'IRMS_MIN', 'Current Min', 'I Min', 'Strom Min'], 26: ['IRMS MAX', 'IRMS_MAX', 'Current Max', 'I Max', 'Strom Max'], 28: ['WATT MIN', 'WATT_MIN', 'Power Min', 'W Min', 'Leistung Min'], 30: ['WATT MAX', 'WATT_MAX', 'Power Max', 'W Max', 'Leistung Max'], 500: ['Temp', 'degree', 'Temperature', '°C', 'Temperatur'], 800: ['Impulse', 'Impuls']}
- phase_map = {'a': 0, 'abc': 300, 'b': 100, 'c': 200}
- upper_cased = {0: ['VRMS', 'V_RMS', 'VOLTAGE', 'V', 'SPANNUNG'], 2: ['IRMS', 'I_RMS', 'CURRENT', 'I', 'STROM'], 4: ['WATT', 'POWER', 'W', 'LEISTUNG', 'WIRKLEISTUNG'], 6: ['VAR', 'REACTIVE POWER', 'VAR', 'BLINDLEISTUNG'], 8: ['VA', 'APPARENT POWER', 'VA', 'SCHEINLEISTUNG'], 10: ['FREQ', 'FREQUENCY', 'HZ', 'FREQUENZ'], 12: ['KWH', 'ENERGY', 'KWH', 'ENERGIE'], 14: ['PF', 'POWER FACTOR', 'PF', 'LEISTUNGSFAKTOR'], 20: ['VRMS MIN', 'VRMS_MIN', 'VOLTAGE MIN', 'V MIN', 'SPANNUNG MIN'], 22: ['VRMS MAX', 'VRMS_MAX', 'VOLTAGE MAX', 'V MAX', 'SPANNUNG MAX'], 24: ['IRMS MIN', 'IRMS_MIN', 'CURRENT MIN', 'I MIN', 'STROM MIN'], 26: ['IRMS MAX', 'IRMS_MAX', 'CURRENT MAX', 'I MAX', 'STROM MAX'], 28: ['WATT MIN', 'WATT_MIN', 'POWER MIN', 'W MIN', 'LEISTUNG MIN'], 30: ['WATT MAX', 'WATT_MAX', 'POWER MAX', 'W MAX', 'LEISTUNG MAX'], 500: ['TEMP', 'DEGREE', 'TEMPERATURE', '°C', 'TEMPERATUR'], 800: ['IMPULSE', 'IMPULS']}