eCactus ECOS Python Client
This Python client provides both synchronous and asynchronous interfaces to interact with the eCactus ECOS platform from WEIHENG Group for energy management. However, this project is in its early stages, is not fully tested, and is not safe for production use. Use it at your own risk.
Features
- Synchronous Access: Use the
Ecosclass for straightforward, blocking operations. - Asynchronous Access: Use the
AsyncEcosclass for non-blocking, concurrent operations.
Installation
python -m venv venv
source venv/bin/activate
pip install ecactus-ecos-py
Usage
Synchronous Client
from ecactus import Ecos
# Initialize the client
session = Ecos(datacenter="EU")
session.login("email@domain.com", "mypassword")
# Fetch user details
user = session.get_user()
print(user)
# Retrieve all the devices
devices = session.get_all_devices()
print(devices)
Asynchronous Client
import asyncio
from ecactus import AsyncEcos
async def main():
# Initialize the client
session = AsyncEcos(datacenter="EU")
await session.login("email@domain.com", "mypassword")
# Fetch user details
user = await session.get_user()
print(user)
# Retrieve all the devices
devices = await session.get_all_devices()
print(devices)
asyncio.run(main())
Examples
A set of ready-to-use scripts is available in the examples/ directory.
Logging
The library logs through the standard logging module, under the ecactus logger.
At DEBUG level it logs every API call and response, with tokens shortened to their
last 4 characters and personal data (email, phone, location) masked:
import logging
logging.getLogger("ecactus").setLevel(logging.DEBUG)
Raw response bodies go to a separate ecactus.wire logger, which stays off even when
the root or ecactus logger is at DEBUG. Turn it on by naming it:
logging.getLogger("ecactus.wire").setLevel(logging.DEBUG)
Warning: ecactus.wire output contains live access and refresh tokens. Never share it.
Documentation
The API references for both Ecos and AsyncEcos clients, is available at:
eCactus ECOS API Client Documentation
Development & Contributing
To set up the project for development, install uv, then clone the repository and install dependencies:
git clone https://github.com/gmasse/ecactus-ecos-py.git
cd ecactus-ecos-py
uv sync # creates .venv from uv.lock, dev tools included
We invite you to contribute to the project by opening an issue or pull request to propose new features, fix bugs, or enhance the documentation.
Pull requests should target the dev branch — main is reserved for releases. See CONTRIBUTING.md for the full contribution workflow.
For pending tasks and improvements, please check the TODO.md file.
Automatic Synchronous Code Generation
The ecactus.Ecos synchronous class, defined in src/ecactus/client.py, is automatically generated from the ecactus.AsyncEcos class using scripts/unasync.py. When making changes to the ecactus.AsyncEcos class, you should re-run this script to regenerate the ecactus.Ecos class:
uv run python scripts/unasync.py
This ensures that both the synchronous and asynchronous APIs remain consistent.
To verify that the generated synchronous class matches the asynchronous class, use the --check option:
uv run python scripts/unasync.py --check
This will report any differences between the two classes, allowing you to catch any inconsistencies before submitting your changes.
Code Quality
- Linting: Run
ruffto check for code style issues:uv run ruff check
- Formatting: Run
ruff formatto apply the code style (CI runsruff format --check):uv run ruff format
- Typing Checks: Use
mypyto ensure type correctness:uv run mypy
- Unit Tests: Run
pytestto execute tests:uv run pytest
Documentation Contribution
Use mkdocs to serve a local preview of the documentation:
uv run mkdocs serve
License
This project is licensed under the GPL-3.0 License. See the LICENSE file for details.
⚠️ Disclaimer
- This project is not affiliated with, endorsed by, or associated with WEIHENG Group, eCactus, ECOS, or any related companies.
- The names WEIHENG, eCactus, and ECOS may be registered trademarks of their respective owners.
- This software is developed independently and does not interact with any proprietary or official services provided by WEIHENG Group or eCactus.
Metadata
Release files for ecactus-ecos-py 0.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ecactus_ecos_py-0.4.2.tar.gz | 39.7 kB | With provenance | Details for ecactus_ecos_py-0.4.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ecactus_ecos_py-0.4.2-py3-none-any.whl | Python 3 | none | any | Details for ecactus_ecos_py-0.4.2-py3-none-any.whl |
Total release size: 71.6 kB
Release files / ecactus_ecos_py-0.4.2.tar.gz
| Download URL | ecactus_ecos_py-0.4.2.tar.gz |
|---|---|
| Size | 39.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f18ef726da1c5a5ca0c65510605db07333c286c715cfe06b9bd375f49f74eba9
|
|
BLAKE2b-256 checksum How to use checksums |
c88676335e6c75c224eb99bb221ad5d9b34f6a945cbbd973943c64e397505a26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logRelease files / ecactus_ecos_py-0.4.2-py3-none-any.whl
| Download URL | ecactus_ecos_py-0.4.2-py3-none-any.whl |
|---|---|
| Size | 31.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
30725fee6d725ffa549edb6ff070e2ec7d75833032549df84e040f49435bc4d6
|
|
BLAKE2b-256 checksum How to use checksums |
fd0686aa16bc57bb9f2ac2d1fe0d4b451f7a724e360ba07c99d0dda0aca49307
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logSecurity for ecactus-ecos-py 0.4.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for ecactus_ecos_py-0.4.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.