hyxi-cloud-api
An asynchronous Python client for interacting with the HYXI Cloud API.
This library was primarily built to power the HYXI Cloud Home Assistant Integration, but it can be used in any Python 3.14 project to fetch telemetry data from HYXI solar inverters and battery systems.
📦 Installation
You can install the package directly from PyPI:
pip install hyxi-cloud-api
🚀 Quick Start
This library uses aiohttp for non-blocking network requests. You will need to provide your Developer API credentials (AK/SK), along with an active aiohttp.ClientSession.
import asyncio
import aiohttp
from hyxi_cloud_api import HyxiApiClient
async def main():
# Replace with your actual HYXi Cloud credentials
ACCESS_KEY = "your_access_key"
SECRET_KEY = "your_secret_key"
BASE_URL = "https://open.hyxicloud.com"
async with aiohttp.ClientSession() as session:
# 1. Initialize the client
client = HyxiApiClient(
access_key=ACCESS_KEY,
secret_key=SECRET_KEY,
base_url=BASE_URL,
session=session,
)
# 2. Fetch device data
try:
device_data = await client.get_all_device_data()
print("Successfully fetched HYXi data:")
print(device_data)
except Exception as e:
print(f"Error communicating with HYXi Cloud: {e}")
if __name__ == "__main__":
asyncio.run(main())
HYXI Open API base URLs vary by region. The examples in this README use the Europe endpoint by default.
| Node | Request Address |
|---|---|
| China | https://open-cn.hyxicloud.com |
| Europe (default) | https://open.hyxicloud.com |
| North America | https://open-or.hyxicloud.com |
🔧 Device Control
You can control inverter operating modes directly through the API. This requires a device serial number, which you can obtain from the device data response above.
async def control_example(client, device_sn):
# Set operating mode
await client.set_mode_self_consume(device_sn)
await client.set_mode_self_consume_with_charging(device_sn)
await client.set_mode_charge(device_sn, watts=3000)
await client.set_mode_discharge(device_sn, watts=2500)
await client.set_mode_idle(device_sn)
# Peak shaving (close, charge, discharge, stop, hold)
await client.set_peak_shaving(device_sn, action="charge")
# Frequency control
await client.set_frequency_control(device_sn, enabled=True)
Control failures raise HyxiApiClient.ControlError:
try:
await client.set_mode_charge(device_sn, watts=3000)
except client.ControlError as e:
print(f"Control command failed: {e}")
Control commands are fire-and-forget; poll query_control_result with the traceId from the response to confirm the device actually applied it:
response = await client.set_mode_charge(device_sn, watts=3000)
trace_id = response["data"][0]["traceId"]
result = await client.query_control_result(trace_id)
# result["data"]["result"]: "2" (issuing), "3" (success), "6" (failure)
🔔 Subscriptions
You can subscribe a callback URL to HYXI push notifications for real-time data, alarms, and FCAS/frequency-modulation real-time data.
async def subscription_example(client):
callback_url = "https://your-public-callback-host/hyxi/callback"
device_sns = ["60700000000001", "60700000000002"]
real_time = await client.subscribe_real_time_data(
callback_url,
device_sns,
post_rate=60000, # milliseconds, 5000-3600000
)
alarm = await client.subscribe_alarm(
callback_url,
device_sns,
post_rate=60000, # milliseconds, 5000-3600000
)
fcas = await client.subscribe_fm_real_time_data(
callback_url,
device_sns,
post_rate=1, # hours, 1-6
)
await client.cancel_subscription(real_time["data"]["subscribeCode"])
Subscription failures raise HyxiApiClient.SubscriptionError.
🛠️ Requirements
- Python 3.14 (not yet 3.15 — the upper bound lifts once 3.15 is covered by CI)
aiohttp>= 3.13.5
🔐 Privacy & Debug Logging
When debug logging is enabled, this library automatically masks sensitive identifiers before writing them to the log — no manual redaction needed.
| Field | Behaviour |
|---|---|
Serial numbers (deviceSn, parentSn, batSn) |
Hashed securely using SHA-256 (first 8 chars shown) to enable deterministic cross-device tracing without exposing the original identifier, e.g. e3b0c442 |
Plant IDs (plantId) |
Same SHA-256 hashing format |
Home/site address (plantAddress) |
Fully redacted → [REDACTED] |
IMEI (gprsImei) |
Same SHA-256 hashing format |
Masking is deterministic, so parent/child device relationships remain traceable across log lines.
⚠️ Disclaimer
This is an unofficial, community-driven project. It is not affiliated with, endorsed by, or connected to HYXiPower in any official capacity. Use this software at your own risk.
Support
If this library is useful to you and you'd like to support its development:
Metadata
Release files for hyxi-cloud-api 1.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hyxi_cloud_api-1.5.1.tar.gz | 106.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hyxi_cloud_api-1.5.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 145.8 kB
Release files / hyxi_cloud_api-1.5.1.tar.gz
| Download URL | hyxi_cloud_api-1.5.1.tar.gz |
|---|---|
| Size | 106.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bd1f2f75d1d88f366ae219bc2ed95af533cba3a9c0fac3cbaff6c7db4459c3c6
|
|
BLAKE2b-256 checksum How to use checksums |
2018e0369644aa63c5d4b092a2547fbf6e2ee00f4d15008fbb3099b6c9cac6f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 9, 2026.
Transparency logRelease files / hyxi_cloud_api-1.5.1-py3-none-any.whl
| Download URL | hyxi_cloud_api-1.5.1-py3-none-any.whl |
|---|---|
| Size | 39.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8af446bb8ff235223ce1cfd61b8a76555fd87b828f0dce1ab7345ae7b60cc8f9
|
|
BLAKE2b-256 checksum How to use checksums |
7947d72c2f27b1e21d50e06b2f275abd85b8c993215b0202cb547cd24fab0ef3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 9, 2026.
Transparency log