Python library for Hypontech Cloud API
Project description
Hypontech Cloud API Python Library
A Python library for interacting with the Hypontech Cloud API for solar inverter monitoring.
Features
- Async/await support using aiohttp
- Get plant overview data (power, energy production, device status)
- Get plant list
- Automatic token management and refresh
- Built-in retry logic for rate limiting
- Type hints for better IDE support
- Comprehensive error handling
Installation
pip install hyponcloud
Quick Start
Basic Usage
import asyncio
from hyponcloud import HyponCloud
async def main():
# Create client with your credentials
async with HyponCloud("your_username", "your_password") as client:
# Connect and authenticate
if await client.connect():
# Get overview data
overview = await client.get_overview()
print(f"Current power: {overview.power}W")
print(f"Today's energy: {overview.e_today}kWh")
print(f"Total energy: {overview.e_total}kWh")
# Get plant list
plants = await client.get_list()
print(f"Number of plants: {len(plants)}")
asyncio.run(main())
Using with Custom aiohttp Session
import aiohttp
from hyponcloud import HyponCloud
async def main():
async with aiohttp.ClientSession() as session:
client = HyponCloud("your_username", "your_password", session=session)
if await client.connect():
overview = await client.get_overview()
print(f"Power: {overview.power}W")
asyncio.run(main())
Error Handling
from hyponcloud import (
HyponCloud,
AuthenticationError,
ConnectionError,
RateLimitError,
)
async def main():
try:
async with HyponCloud("username", "password") as client:
await client.connect()
overview = await client.get_overview()
print(f"Power: {overview.power}W")
except AuthenticationError as e:
print(f"Authentication failed: {e}")
except RateLimitError as e:
print(f"Rate limit exceeded: {e}")
except ConnectionError as e:
print(f"Connection error: {e}")
asyncio.run(main())
API Reference
HyponCloud
Main client class for interacting with the Hypontech Cloud API.
Methods
__init__(username: str, password: str, session: aiohttp.ClientSession | None = None)
Initialize the client.
username: Your Hypontech Cloud usernamepassword: Your Hypontech Cloud passwordsession: Optional aiohttp ClientSession. If not provided, one will be created automatically.
async connect() -> bool
Authenticate with the API and retrieve access token.
Returns: True if successful, False otherwise
Raises:
AuthenticationError: Invalid credentialsConnectionError: Network errorRateLimitError: Too many requests
async get_overview(retries: int = 3) -> OverviewData
Get plant overview data including power generation and device status.
Parameters:
retries: Number of retry attempts on failure (default: 3)
Returns: OverviewData object
Raises:
AuthenticationError: Authentication requiredConnectionError: Network errorRateLimitError: Too many requests
async get_list(retries: int = 3) -> list[dict]
Get list of plants associated with the account.
Parameters:
retries: Number of retry attempts on failure (default: 3)
Returns: List of plant dictionaries
Raises:
AuthenticationError: Authentication requiredConnectionError: Network errorRateLimitError: Too many requests
async close() -> None
Close the aiohttp session (only if created by the library).
OverviewData
Data class containing plant overview information.
Attributes
capacity(float): Plant capacitycapacity_company(str): Capacity unit (e.g., "KW")power(int): Current power generation in wattscompany(str): Power unit (e.g., "W")percent(int): Percentage valuee_today(float): Today's energy production in kWhe_total(float): Total lifetime energy production in kWhfault_dev_num(int): Number of faulty devicesnormal_dev_num(int): Number of normal devicesoffline_dev_num(int): Number of offline deviceswait_dev_num(int): Number of devices waitingtotal_co2(int): Total CO2 savingstotal_tree(float): Equivalent trees planted
PlantData
Data class containing individual plant information.
Attributes
city(str): Plant location citycountry(str): Plant location countrye_today(float): Today's energy productione_total(float): Total energy productioneid(int): Equipment IDkwhimp(int): kWh importmicro(int): Micro inverter countplant_id(str): Unique plant identifierplant_name(str): Plant nameplant_type(str): Plant typepower(int): Current powerstatus(str): Plant status
Exceptions
HyponCloudError: Base exception for all library errorsAuthenticationError: Authentication failed (invalid credentials)ConnectionError: Connection to API failedRateLimitError: API rate limit exceeded
Development
Setup Development Environment
# Clone the repository
git clone https://github.com/jcisio/hyponcloud.git
cd hyponcloud
# Install development dependencies
pip install -e ".[dev]"
# Set up pre-commit hooks (optional but recommended)
pre-commit install
Running Tests
pytest
Code Formatting
ruff check .
ruff format .
Type Checking
mypy hyponcloud
Version Management
This project uses setuptools-scm for automatic version management:
- Versions are automatically determined from git tags
- Use semantic versioning (e.g.,
v0.1.2) - Create a git tag and push to trigger automated publishing via GitHub Actions
git tag v0.1.2
git push origin v0.1.2
Requirements
- Python 3.11+
- aiohttp 3.8.0+
- mashumaro 3.11+
Build Requirements
- setuptools-scm 8.0+ (automatically installed during build for version management)
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Disclaimer
This library is not officially associated with or endorsed by Hypontech. Use at your own risk.
Support
For issues, questions, or contributions, please visit the GitHub repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hyponcloud-0.2.1.tar.gz.
File metadata
- Download URL: hyponcloud-0.2.1.tar.gz
- Upload date:
- Size: 15.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c45e5ea9f315f3c47da7c3f292e17e751a2ce51f6c0d606d69eb98378425cd4e
|
|
| MD5 |
41f82b2c304972c71e8128fa5a0b9a88
|
|
| BLAKE2b-256 |
554fcb30c78640268764381382a87755f9ee7cfd77822ac0d9ffdf7ecd0c82cc
|
Provenance
The following attestation bundles were made for hyponcloud-0.2.1.tar.gz:
Publisher:
publish.yml on jcisio/hyponcloud
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hyponcloud-0.2.1.tar.gz -
Subject digest:
c45e5ea9f315f3c47da7c3f292e17e751a2ce51f6c0d606d69eb98378425cd4e - Sigstore transparency entry: 782163861
- Sigstore integration time:
-
Permalink:
jcisio/hyponcloud@978bb53c4d4fd9caeacc12d41b5430619e5484cb -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/jcisio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@978bb53c4d4fd9caeacc12d41b5430619e5484cb -
Trigger Event:
push
-
Statement type:
File details
Details for the file hyponcloud-0.2.1-py3-none-any.whl.
File metadata
- Download URL: hyponcloud-0.2.1-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
053bd6f8574cdfe2b8ad76e14542848a1ee9f70afc57da085a11588aaedf3994
|
|
| MD5 |
d8e341a9b501996ae1a3604a05a3e210
|
|
| BLAKE2b-256 |
42fe95bafd7c5e061f8dde0f2913028e941fad6bc8312dfd521e39f873d3d498
|
Provenance
The following attestation bundles were made for hyponcloud-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on jcisio/hyponcloud
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hyponcloud-0.2.1-py3-none-any.whl -
Subject digest:
053bd6f8574cdfe2b8ad76e14542848a1ee9f70afc57da085a11588aaedf3994 - Sigstore transparency entry: 782163863
- Sigstore integration time:
-
Permalink:
jcisio/hyponcloud@978bb53c4d4fd9caeacc12d41b5430619e5484cb -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/jcisio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@978bb53c4d4fd9caeacc12d41b5430619e5484cb -
Trigger Event:
push
-
Statement type: