Registry / http-networking / huawei-solar

huawei-solar

JSON →
library3.0.6pypypi✓ verified 82d ago

A Python wrapper for the Huawei Inverter Modbus TCP API. Current version is 3.0.0 (stable), released 2024. Releases are semi-regular. The v3 major release introduced breaking changes, including migration from pyModbus to tModbus, renaming of "bridge" classes to "device" classes, and replacement of `slave_id` with `unit_id`.

pip install huawei-solar
INSTALL
IMPORT
SIG · HUAWEI-SOLAR
H
huawei-solar
http-networkingpythonv3.0.6
Install
2.0s avg
Import
257ms
Disk
20MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.112s · 23.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.0s · import 0.094s · 24MB
20MB installed
● package 20MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AsyncHuaweiSolarClient
from huawei_solar import AsyncHuaweiSolarClient
from huawei_solar import HuaweiSolarBridge
HuaweiSolarDevice
from huawei_solar import HuaweiSolarDevice
HuaweiSolarException
from huawei_solar import HuaweiSolarException

Connects to a Huawei inverter over TCP and reads a register.

import asyncio from huawei_solar import HuaweiSun2000 async def main(): # Connect over TCP inverter = HuaweiSun2000(host='192.168.1.100', port=502) await inverter.start() # Read a register, e.g., 'input_power' result = await inverter.read('input_power') print(f'Input power: {result.value} W') await inverter.stop() asyncio.run(main())
Debug
Known issues
breakingv3 migration: `slave_id` parameter replaced with `unit_id` in all device classes.
fix
Change `slave_id=1` to `unit_id=1` when instantiating HuaweiSun2000.
affects: <3.0.0
gotchaThe library uses asyncio; all read/write operations must be awaited. Forgetting `await` will hang the coroutine.
fix
Always use `await` when calling methods like `read()`, `write()`, `start()`, `stop()`.
affects: >=1.0.0
deprecatedThe class `HuaweiSolarBridge` is deprecated in v3; use `HuaweiSun2000` (or `HuaweiSmartLogger`, `HuaweiSCharger`, `HuaweiSdongle`) instead.
fix
Replace `HuaweiSolarBridge` with the appropriate device class depending on the hardware.
affects: 3.0.0
gotchaWhen connecting via SmartLogger, not all registers are available (e.g., capacity control mode).
fix
Check the device's capabilities via `inverter.capabilities` attribute.
affects: >=3.0.0
Upgrade
Version history
3.0.6latest on PyPI · released Jun 3, 2026
Audit
Dependencies
tmodbusrequiredRequired for Modbus communication since v3
pyserial-asynciooptionalRequired for serial connection (optional, for SunSpec)
Agent activity
37 hits · last 30 days
node
32
OpenAI (training)
1
Resources
huawei-solar — pip install huawei-solar · libregistry