py-sungrow-isolarcloud 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- py_sungrow_isolarcloud-0.1.0/LICENSE +21 -0
- py_sungrow_isolarcloud-0.1.0/PKG-INFO +87 -0
- py_sungrow_isolarcloud-0.1.0/README.md +68 -0
- py_sungrow_isolarcloud-0.1.0/pyproject.toml +46 -0
- py_sungrow_isolarcloud-0.1.0/setup.cfg +4 -0
- py_sungrow_isolarcloud-0.1.0/src/py_sungrow_isolarcloud/__init__.py +42 -0
- py_sungrow_isolarcloud-0.1.0/src/py_sungrow_isolarcloud/client.py +472 -0
- py_sungrow_isolarcloud-0.1.0/src/py_sungrow_isolarcloud/const.py +48 -0
- py_sungrow_isolarcloud-0.1.0/src/py_sungrow_isolarcloud/crypto.py +93 -0
- py_sungrow_isolarcloud-0.1.0/src/py_sungrow_isolarcloud/models.py +519 -0
- py_sungrow_isolarcloud-0.1.0/src/py_sungrow_isolarcloud/py.typed +0 -0
- py_sungrow_isolarcloud-0.1.0/src/py_sungrow_isolarcloud.egg-info/PKG-INFO +87 -0
- py_sungrow_isolarcloud-0.1.0/src/py_sungrow_isolarcloud.egg-info/SOURCES.txt +17 -0
- py_sungrow_isolarcloud-0.1.0/src/py_sungrow_isolarcloud.egg-info/dependency_links.txt +1 -0
- py_sungrow_isolarcloud-0.1.0/src/py_sungrow_isolarcloud.egg-info/requires.txt +7 -0
- py_sungrow_isolarcloud-0.1.0/src/py_sungrow_isolarcloud.egg-info/top_level.txt +1 -0
- py_sungrow_isolarcloud-0.1.0/tests/test_client.py +177 -0
- py_sungrow_isolarcloud-0.1.0/tests/test_crypto.py +46 -0
- py_sungrow_isolarcloud-0.1.0/tests/test_models.py +137 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 skamoll
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY KIND, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: py-sungrow-isolarcloud
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Async Python client library for the Sungrow iSolarCloud API
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/skamoll/py-sungrow-isolarcloud
|
|
7
|
+
Project-URL: Repository, https://github.com/skamoll/py-sungrow-isolarcloud
|
|
8
|
+
Project-URL: Issues, https://github.com/skamoll/py-sungrow-isolarcloud/issues
|
|
9
|
+
Requires-Python: >=3.12
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: aiohttp>=3.9.0
|
|
13
|
+
Requires-Dist: cryptography>=42.0.0
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
16
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
|
|
17
|
+
Requires-Dist: ruff>=0.6.0; extra == "dev"
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# py-sungrow-isolarcloud
|
|
21
|
+
|
|
22
|
+
[](https://github.com/skamoll/py-sungrow-isolarcloud/actions/workflows/ci.yml)
|
|
23
|
+
[](LICENSE)
|
|
24
|
+
|
|
25
|
+
Typed, asynchronous Python client library for the **Sungrow iSolarCloud** cloud API.
|
|
26
|
+
|
|
27
|
+
For the Home Assistant custom integration (HACS) built on top of this library, see [`skamoll/hass_sungrow_isolarcloud`](https://github.com/skamoll/hass_sungrow_isolarcloud).
|
|
28
|
+
|
|
29
|
+
## Features
|
|
30
|
+
|
|
31
|
+
- **Encrypted Wire Protocol:** RSA PKCS#1 v1.5 key exchange + AES-128-ECB payload encryption/decryption with automatic clock-skew (`Expired request`) and session-expiry recovery.
|
|
32
|
+
- **Regional Gateway Auto-Discovery:** Supports `auto` probing across `eu`, `com`, `au`, `hk`, `cn`, and `in`, or explicit regional selection.
|
|
33
|
+
- **Ecosystem-Wide Models:** Parses plant summaries (`PlantSummary`), energy flows & directional powers (`PlantFlow`), device inventories (`DeviceSummary`), dynamic per-device telemetry (`DevicePoint`), conditional active faults (`ActiveFault`), local plant weather (`PlantWeather`), and EV chargers (`ChargingPileSummary`).
|
|
34
|
+
- **Canonical Units & Locale Support:** Normalizes power (`W`/`kW`/`MW` -> `kW`), energy (`Wh`/`kWh`/`MWh` -> `kWh`), temperatures (`°C`/`°F`), and reactive/apparent power (`var`/`VA`), with iSolarCloud `lang` support (`_en_US`, `_es_ES`, `_de_DE`, `_fr_FR`, etc.).
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install py-sungrow-isolarcloud
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
import asyncio
|
|
46
|
+
import aiohttp
|
|
47
|
+
from py_sungrow_isolarcloud import GATEWAY_AUTO, ISolarCloudClient
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
async def main() -> None:
|
|
51
|
+
async with aiohttp.ClientSession() as session:
|
|
52
|
+
client = ISolarCloudClient(
|
|
53
|
+
session=session,
|
|
54
|
+
username="user@example.com",
|
|
55
|
+
password="your-password",
|
|
56
|
+
gateway=GATEWAY_AUTO,
|
|
57
|
+
lang="_en_US",
|
|
58
|
+
)
|
|
59
|
+
plants = await client.async_fetch_all_plants()
|
|
60
|
+
for ps_id, plant in plants.items():
|
|
61
|
+
print(ps_id, plant.summary.ps_name, plant.flow.pv_power)
|
|
62
|
+
for dev in plant.devices:
|
|
63
|
+
print(" ", dev.device_name, dev.device_model, len(dev.points), "points")
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
asyncio.run(main())
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Development
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
python -m venv .venv
|
|
73
|
+
source .venv/bin/activate
|
|
74
|
+
pip install -e ".[dev]"
|
|
75
|
+
ruff check . && ruff format --check .
|
|
76
|
+
pytest -v
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Contributing, Issues & Security
|
|
80
|
+
|
|
81
|
+
- **Contributing:** See [CONTRIBUTING.md](CONTRIBUTING.md) and our [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
82
|
+
- **Reporting Bugs & Feature Requests:** Open an issue using the [GitHub Issue Templates](https://github.com/skamoll/py-sungrow-isolarcloud/issues/new/choose). Never include credentials, tokens, or personal plant IDs.
|
|
83
|
+
- **Security Vulnerabilities:** Please report privately via [SECURITY.md](SECURITY.md) instead of opening a public issue.
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
Licensed under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# py-sungrow-isolarcloud
|
|
2
|
+
|
|
3
|
+
[](https://github.com/skamoll/py-sungrow-isolarcloud/actions/workflows/ci.yml)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
Typed, asynchronous Python client library for the **Sungrow iSolarCloud** cloud API.
|
|
7
|
+
|
|
8
|
+
For the Home Assistant custom integration (HACS) built on top of this library, see [`skamoll/hass_sungrow_isolarcloud`](https://github.com/skamoll/hass_sungrow_isolarcloud).
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- **Encrypted Wire Protocol:** RSA PKCS#1 v1.5 key exchange + AES-128-ECB payload encryption/decryption with automatic clock-skew (`Expired request`) and session-expiry recovery.
|
|
13
|
+
- **Regional Gateway Auto-Discovery:** Supports `auto` probing across `eu`, `com`, `au`, `hk`, `cn`, and `in`, or explicit regional selection.
|
|
14
|
+
- **Ecosystem-Wide Models:** Parses plant summaries (`PlantSummary`), energy flows & directional powers (`PlantFlow`), device inventories (`DeviceSummary`), dynamic per-device telemetry (`DevicePoint`), conditional active faults (`ActiveFault`), local plant weather (`PlantWeather`), and EV chargers (`ChargingPileSummary`).
|
|
15
|
+
- **Canonical Units & Locale Support:** Normalizes power (`W`/`kW`/`MW` -> `kW`), energy (`Wh`/`kWh`/`MWh` -> `kWh`), temperatures (`°C`/`°F`), and reactive/apparent power (`var`/`VA`), with iSolarCloud `lang` support (`_en_US`, `_es_ES`, `_de_DE`, `_fr_FR`, etc.).
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install py-sungrow-isolarcloud
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
import asyncio
|
|
27
|
+
import aiohttp
|
|
28
|
+
from py_sungrow_isolarcloud import GATEWAY_AUTO, ISolarCloudClient
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
async def main() -> None:
|
|
32
|
+
async with aiohttp.ClientSession() as session:
|
|
33
|
+
client = ISolarCloudClient(
|
|
34
|
+
session=session,
|
|
35
|
+
username="user@example.com",
|
|
36
|
+
password="your-password",
|
|
37
|
+
gateway=GATEWAY_AUTO,
|
|
38
|
+
lang="_en_US",
|
|
39
|
+
)
|
|
40
|
+
plants = await client.async_fetch_all_plants()
|
|
41
|
+
for ps_id, plant in plants.items():
|
|
42
|
+
print(ps_id, plant.summary.ps_name, plant.flow.pv_power)
|
|
43
|
+
for dev in plant.devices:
|
|
44
|
+
print(" ", dev.device_name, dev.device_model, len(dev.points), "points")
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
asyncio.run(main())
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Development
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
python -m venv .venv
|
|
54
|
+
source .venv/bin/activate
|
|
55
|
+
pip install -e ".[dev]"
|
|
56
|
+
ruff check . && ruff format --check .
|
|
57
|
+
pytest -v
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Contributing, Issues & Security
|
|
61
|
+
|
|
62
|
+
- **Contributing:** See [CONTRIBUTING.md](CONTRIBUTING.md) and our [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
63
|
+
- **Reporting Bugs & Feature Requests:** Open an issue using the [GitHub Issue Templates](https://github.com/skamoll/py-sungrow-isolarcloud/issues/new/choose). Never include credentials, tokens, or personal plant IDs.
|
|
64
|
+
- **Security Vulnerabilities:** Please report privately via [SECURITY.md](SECURITY.md) instead of opening a public issue.
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
|
|
68
|
+
Licensed under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "py-sungrow-isolarcloud"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Async Python client library for the Sungrow iSolarCloud API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.12"
|
|
12
|
+
dependencies = [
|
|
13
|
+
"aiohttp>=3.9.0",
|
|
14
|
+
"cryptography>=42.0.0",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
[project.urls]
|
|
18
|
+
Homepage = "https://github.com/skamoll/py-sungrow-isolarcloud"
|
|
19
|
+
Repository = "https://github.com/skamoll/py-sungrow-isolarcloud"
|
|
20
|
+
Issues = "https://github.com/skamoll/py-sungrow-isolarcloud/issues"
|
|
21
|
+
|
|
22
|
+
[project.optional-dependencies]
|
|
23
|
+
dev = [
|
|
24
|
+
"pytest>=8.0.0",
|
|
25
|
+
"pytest-asyncio>=0.23.0",
|
|
26
|
+
"ruff>=0.6.0",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[tool.setuptools.packages.find]
|
|
30
|
+
where = ["src"]
|
|
31
|
+
|
|
32
|
+
[tool.setuptools.package-data]
|
|
33
|
+
py_sungrow_isolarcloud = ["py.typed"]
|
|
34
|
+
|
|
35
|
+
[tool.pytest.ini_options]
|
|
36
|
+
pythonpath = ["src"]
|
|
37
|
+
asyncio_mode = "auto"
|
|
38
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
39
|
+
testpaths = ["tests"]
|
|
40
|
+
|
|
41
|
+
[tool.ruff]
|
|
42
|
+
target-version = "py312"
|
|
43
|
+
line-length = 100
|
|
44
|
+
|
|
45
|
+
[tool.ruff.lint]
|
|
46
|
+
select = ["E", "F", "I", "UP", "B", "SIM"]
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Async iSolarCloud API client package."""
|
|
2
|
+
|
|
3
|
+
from .client import (
|
|
4
|
+
ISolarCloudApiError,
|
|
5
|
+
ISolarCloudAuthError,
|
|
6
|
+
ISolarCloudClient,
|
|
7
|
+
ISolarCloudConnectionError,
|
|
8
|
+
ISolarCloudError,
|
|
9
|
+
)
|
|
10
|
+
from .const import GATEWAY_AUTO, GATEWAYS
|
|
11
|
+
from .models import (
|
|
12
|
+
ActiveFault,
|
|
13
|
+
AuthSession,
|
|
14
|
+
ChargingPileSummary,
|
|
15
|
+
DevicePoint,
|
|
16
|
+
DeviceSummary,
|
|
17
|
+
PlantData,
|
|
18
|
+
PlantFlow,
|
|
19
|
+
PlantSummary,
|
|
20
|
+
PlantWeather,
|
|
21
|
+
ValueUnit,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"ActiveFault",
|
|
26
|
+
"AuthSession",
|
|
27
|
+
"ChargingPileSummary",
|
|
28
|
+
"DevicePoint",
|
|
29
|
+
"DeviceSummary",
|
|
30
|
+
"GATEWAYS",
|
|
31
|
+
"GATEWAY_AUTO",
|
|
32
|
+
"ISolarCloudApiError",
|
|
33
|
+
"ISolarCloudAuthError",
|
|
34
|
+
"ISolarCloudClient",
|
|
35
|
+
"ISolarCloudConnectionError",
|
|
36
|
+
"ISolarCloudError",
|
|
37
|
+
"PlantData",
|
|
38
|
+
"PlantFlow",
|
|
39
|
+
"PlantSummary",
|
|
40
|
+
"PlantWeather",
|
|
41
|
+
"ValueUnit",
|
|
42
|
+
]
|