{"id":21445,"library":"huawei-solar","title":"Huawei Solar","description":"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`.","status":"active","version":"3.0.0","language":"python","source_language":"en","source_url":"https://github.com/wlcrs/huawei-solar-lib","tags":["huawei","solar","inverter","modbus","tcp","asyncio"],"install":[{"cmd":"pip install huawei-solar","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Required for Modbus communication since v3","package":"tmodbus","optional":false},{"reason":"Required for serial connection (optional, for SunSpec)","package":"pyserial-asyncio","optional":true}],"imports":[{"wrong":"from huawei_solar import HuaweiSolarBridge","symbol":"AsyncHuaweiSolarClient","correct":"from huawei_solar import AsyncHuaweiSolarClient"},{"symbol":"HuaweiSolarDevice","correct":"from huawei_solar import HuaweiSolarDevice"},{"symbol":"HuaweiSolarException","correct":"from huawei_solar import HuaweiSolarException"}],"quickstart":{"code":"import asyncio\nfrom huawei_solar import HuaweiSun2000\n\nasync def main():\n    # Connect over TCP\n    inverter = HuaweiSun2000(host='192.168.1.100', port=502)\n    await inverter.start()\n    # Read a register, e.g., 'input_power'\n    result = await inverter.read('input_power')\n    print(f'Input power: {result.value} W')\n    await inverter.stop()\n\nasyncio.run(main())","lang":"python","description":"Connects to a Huawei inverter over TCP and reads a register."},"warnings":[{"fix":"Change `slave_id=1` to `unit_id=1` when instantiating HuaweiSun2000.","message":"v3 migration: `slave_id` parameter replaced with `unit_id` in all device classes.","severity":"breaking","affected_versions":"<3.0.0"},{"fix":"Always use `await` when calling methods like `read()`, `write()`, `start()`, `stop()`.","message":"The library uses asyncio; all read/write operations must be awaited. Forgetting `await` will hang the coroutine.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Replace `HuaweiSolarBridge` with the appropriate device class depending on the hardware.","message":"The class `HuaweiSolarBridge` is deprecated in v3; use `HuaweiSun2000` (or `HuaweiSmartLogger`, `HuaweiSCharger`, `HuaweiSdongle`) instead.","severity":"deprecated","affected_versions":"3.0.0"},{"fix":"Check the device's capabilities via `inverter.capabilities` attribute.","message":"When connecting via SmartLogger, not all registers are available (e.g., capacity control mode).","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"search_vec":"'2024':19 '3.0.0':16 'api':12 'asyncio':58 'break':30 'bridg':40 'chang':31 'class':41,44 'current':13 'devic':43 'huawei':1,8,53 'id':49,52 'includ':32 'introduc':29 'invert':9,55 'major':27 'migrat':33 'modbus':10,56 'pymodbus':35 'python':4 'regular':24 'releas':18,20,28 'renam':38 'replac':46 'semi':23 'semi-regular':22 'slave':48 'solar':2,54 'stabl':17 'tcp':11,57 'tmodbus':37 'unit':51 'v3':26 'version':14 'wrapper':5","created_at":"2026-04-27T16:59:56.225624+00:00","updated_at":"2026-04-27T16:59:56.225624+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"3.0.6","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/wlcrs/huawei-solar-lib","docs":null,"changelog":"https://github.com/wlcrs/huawei-solar-lib/releases","pypi":"https://pypi.org/project/huawei-solar/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking","communication"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-06-30","next_check":"2026-07-30","install_tag":null}}