connection_manager
frequenz.sdk.microgrid.connection_manager ¤
Microgrid Connection Manager singleton abstraction.
This module provides a singleton abstraction over the microgrid. The main purpose is to provide the connection the microgrid API client and the microgrid component graph.
Classes¤
frequenz.sdk.microgrid.connection_manager.ConnectionManager ¤
Bases: ABC
Creates and stores core features.
Source code in frequenz/sdk/microgrid/connection_manager.py
Attributes¤
api_client
abstractmethod
property
¤
api_client: ApiClient
Get ApiClient.
RETURNS | DESCRIPTION |
---|---|
ApiClient
|
api client |
component_graph
abstractmethod
property
¤
component_graph: ComponentGraph
Get component graph.
RETURNS | DESCRIPTION |
---|---|
ComponentGraph
|
component graph |
location
abstractmethod
property
¤
location: Location | None
Get the location of the microgrid if available.
RETURNS | DESCRIPTION |
---|---|
Location | None
|
the location of the microgrid if available, None otherwise. |
microgrid_id
abstractmethod
property
¤
microgrid_id: int | None
Get the ID of the microgrid if available.
RETURNS | DESCRIPTION |
---|---|
int | None
|
the ID of the microgrid if available, None otherwise. |
server_url
property
¤
server_url: str
The location of the microgrid API server in the form of a URL.
Functions¤
__init__ ¤
__init__(server_url: str) -> None
Create object instance.
PARAMETER | DESCRIPTION |
---|---|
server_url |
The location of the microgrid API server in the form of a URL.
The following format is expected:
TYPE:
|
Source code in frequenz/sdk/microgrid/connection_manager.py
Functions¤
frequenz.sdk.microgrid.connection_manager.get ¤
get() -> ConnectionManager
Get the MicrogridApi instance created by initialize().
This function should be only called after initialize().
RAISES | DESCRIPTION |
---|---|
RuntimeError
|
Raised when:
* If |
RETURNS | DESCRIPTION |
---|---|
ConnectionManager
|
MicrogridApi instance. |
Source code in frequenz/sdk/microgrid/connection_manager.py
frequenz.sdk.microgrid.connection_manager.initialize
async
¤
initialize(server_url: str) -> None
Initialize the MicrogridApi. This function should be called only once.
PARAMETER | DESCRIPTION |
---|---|
server_url |
The location of the microgrid API server in the form of a URL.
The following format is expected:
TYPE:
|
RAISES | DESCRIPTION |
---|---|
AssertionError
|
If method was called more then once. |