eta_utility.connectors.emonio module

class eta_utility.connectors.emonio.EmonioConnection(url: str, *, nodes: Nodes[NodeEmonio] | None = None, check_error: bool = True)[source]

Bases: Connection[NodeEmonio]

Thin wrapper class for the Emonio that uses a modbus TCP Connection. Internally the Emonio nodes are converted to modbus nodes with fixed parameters, expect for the name, url and channel. If nodes have specified a phase, the connection will check if the phase is connected. Additionally, the connection will check for Emonio errors and warnings (max. every minute).

When creating a NodeEmonio the parameter (and resulting modbus channel) is set by the name of the node (case insensitive). See Available Emonio Nodes for for possible parameter names. Alternatively, the address (modbus channel) can be set manually.

The phase is set by the phase attribute of the node. Possible values are a, b, c or abc, with abc being the default.

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

Read the values of the selected nodes. If nodes is None, all previously selected nodes will be read.

Parameters:

nodes – List of nodes to read from.

Returns:

Dataframe with the read values.

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

Warning

Not implemented: Writing to Emonio nodes is not supported.

subscribe(handler: SubscriptionHandler, nodes: Nodes[NodeEmonio] | None = None, interval: TimeStep = 1) None[source]

Subscribe to the selected nodes. The Modbus connection does all the handling.

Parameters:
  • handler – The handler to subscribe.

  • nodes – List of nodes to subscribe to.

  • interval – The interval in seconds to read the values.

close_sub() None[source]

Close the subscription of the modus connection.

check_warnings_and_errors() None[source]

Calls the error and warning check if the last check was more than a minute ago.

class eta_utility.connectors.emonio.NodeModbusFactory(url: str)[source]

Bases: object

The NodeModbusFactory is a factory class that creates NodeModbus objects with fixed parameters, expect: name, url and mb_channel.

Has to be initialized with the url of the Emonio.

It’s a helper class for the EmonioConnection to create its modbus nodes. It also can be used to manually create a NodeModbus object, which has to be read with a ModbusConnection. (not recommended, use the EmonioConnection instead)

get_default_node(name: str, channel: int) NodeModbus[source]

Create a modbus node for reading Emonio values.

Parameters:
  • name – Name of the node.

  • channel – Modbus channel of the node. (Emonio address)

get_discrete_input_node(name: str, channel: int) NodeModbus[source]

Create a modbus node for reading the connection status of the Emonio phases.

Parameters:
  • name – Name of the node.

  • channel – Modbus channel of the node. (Emonio address)

get_warnings_errors_node(name: str, channel: int) NodeModbus[source]

Create a modbus node for reading the error and warning registers of the Emonio.

Parameters:
  • name – Name of the node.

  • channel – Modbus channel of the node. (Emonio address)