Reference
Top-level module for importing the Ecos class.
AsyncEcos(datacenter=None, url=None, access_token=None, refresh_token=None)
Asynchronous ECOS API client class.
This class provides methods for interacting with the ECOS API, including
authentication, retrieving user information, and managing homes. It uses
the aiohttp
library to make asynchonous HTTP requests to the API.
Initialize a session with ECOS API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
datacenter
|
Optional[str]
|
The location of the ECOS API datacenter.
Can be one of |
None
|
url
|
Optional[str]
|
The URL of the ECOS API. If specified, |
None
|
access_token
|
Optional[str]
|
The access token for authentication with the ECOS API. |
None
|
refresh_token
|
Optional[str]
|
The refresh token for authentication with the ECOS API. |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
If |
Source code in src/ecactus/_base.py
login(email, password)
async
Authenticate with the ECOS API using a provided email and password.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
email
|
str
|
The user's email to use for authentication. |
required |
password
|
str
|
The user's password to use for authentication. |
required |
Source code in src/ecactus/_async_client.py
get_user_info()
async
Get user details.
Returns:
Type | Description |
---|---|
JSON
|
Details concerning the user. Example: |
Source code in src/ecactus/_async_client.py
get_homes()
async
Get a list of homes.
Returns:
Source code in src/ecactus/_async_client.py
get_devices(home_id)
async
Get a list of devices for a home.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
home_id
|
str
|
The home ID to get devices for. |
required |
Returns:
Source code in src/ecactus/_async_client.py
get_all_devices()
async
Get a list of all the devices.
Returns:
Source code in src/ecactus/_async_client.py
get_today_device_data(device_id)
async
Get power metrics of the current day until now.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device_id
|
str
|
The device ID to get power metrics for. |
required |
Returns:
Type | Description |
---|---|
JSON
|
Source code in src/ecactus/_async_client.py
get_realtime_home_data(home_id)
async
Get current power for the home.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
home_id
|
str
|
The home ID to get current power for. |
required |
Returns:
Type | Description |
---|---|
JSON
|
Source code in src/ecactus/_async_client.py
get_realtime_device_data(device_id)
async
Get current power for a device.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device_id
|
str
|
The device ID to get current power for. |
required |
Returns:
Source code in src/ecactus/_async_client.py
get_history(device_id, start_date, period_type)
async
Get aggregated energy for a period.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device_id
|
str
|
The device ID to get history for. |
required |
start_date
|
datetime
|
The start date. |
required |
period_type
|
int
|
Possible value:
|
required |
Returns:
Type | Description |
---|---|
JSON
|
Source code in src/ecactus/_async_client.py
get_insight(device_id, start_date, period_type)
async
Get energy metrics and statistics of a device for a period.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device_id
|
str
|
The device ID to get data for. |
required |
start_date
|
datetime
|
The start date. |
required |
period_type
|
int
|
Possible value:
|
required |
Returns:
Source code in src/ecactus/_async_client.py
Ecos(datacenter=None, url=None, access_token=None, refresh_token=None)
Synchronous ECOS API client class.
This class provides methods for interacting with the ECOS API, including
authentication, retrieving user information, and managing homes. It uses
the requests
library to make HTTP requests to the API.
Initialize a session with ECOS API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
datacenter
|
Optional[str]
|
The location of the ECOS API datacenter.
Can be one of |
None
|
url
|
Optional[str]
|
The URL of the ECOS API. If specified, |
None
|
access_token
|
Optional[str]
|
The access token for authentication with the ECOS API. |
None
|
refresh_token
|
Optional[str]
|
The refresh token for authentication with the ECOS API. |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
If |
Source code in src/ecactus/_base.py
login(email, password)
Authenticate with the ECOS API using a provided email and password.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
email
|
str
|
The user's email to use for authentication. |
required |
password
|
str
|
The user's password to use for authentication. |
required |
Source code in src/ecactus/_client.py
get_user_info()
Get user details.
Returns:
Type | Description |
---|---|
JSON
|
Details concerning the user. Example: |
Source code in src/ecactus/_client.py
get_homes()
Get a list of homes.
Returns:
Source code in src/ecactus/_client.py
get_devices(home_id)
Get a list of devices for a home.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
home_id
|
str
|
The home ID to get devices for. |
required |
Returns:
Source code in src/ecactus/_client.py
get_all_devices()
Get a list of all the devices.
Returns:
Source code in src/ecactus/_client.py
get_today_device_data(device_id)
Get power metrics of the current day until now.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device_id
|
str
|
The device ID to get power metrics for. |
required |
Returns:
Type | Description |
---|---|
JSON
|
Source code in src/ecactus/_client.py
get_realtime_home_data(home_id)
Get current power for the home.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
home_id
|
str
|
The home ID to get current power for. |
required |
Returns:
Type | Description |
---|---|
JSON
|
Source code in src/ecactus/_client.py
get_realtime_device_data(device_id)
Get current power for a device.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device_id
|
str
|
The device ID to get current power for. |
required |
Returns:
Source code in src/ecactus/_client.py
get_history(device_id, start_date, period_type)
Get aggregated energy for a period.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device_id
|
str
|
The device ID to get history for. |
required |
start_date
|
datetime
|
The start date. |
required |
period_type
|
int
|
Possible value:
|
required |
Returns:
Type | Description |
---|---|
JSON
|
Source code in src/ecactus/_client.py
get_insight(device_id, start_date, period_type)
Get energy metrics and statistics of a device for a period.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device_id
|
str
|
The device ID to get data for. |
required |
start_date
|
datetime
|
The start date. |
required |
period_type
|
int
|
Possible value:
|
required |
Returns: