--- id: huawei-solar version: "3.0.7" license: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this… (full text in the JSON record) license_treatment: agpl maintenance: active --- # huawei-solar — A Python wrapper for the Huawei Inverter modbus TCP API License: agpl · Maintenance: active · Downloads: 136.0K/mo ## What it is and what it does huawei-solar is a Python library that abstracts the Modbus protocol to communicate with Huawei solar inverters (SUN2000), batteries (LUNA2000), and related devices. It provides both a low-level Modbus client for direct register access and a high-level device interface that handles register batching, unit conversion, and authentication. The library was originally developed to support Home Assistant integration but works as a standalone tool for any application needing to monitor or control Huawei solar equipment over local Modbus-TCP (via SDongle, EMMA, or WiFi) or Modbus-RTU (via RS485 serial connection). The package depends only on tmodbus for Modbus protocol handling and supports modern Python versions (3.12, 3.13, 3.14). It includes features for reading optimizer data, writing battery parameters, and performing installer-level login sequences. The main constraint is that Huawei devices allow only one active connection at a time, so you must ensure no other client is attempting to connect while your session is active. Use it for: - Monitor real-time power output and voltage from a SUN2000 inverter in a home solar installation - Read battery state-of-charge and temperature from a LUNA2000 battery connected to an inverter - Integrate Huawei solar data into a Home Assistant automation or custom monitoring dashboard - Write battery charge/discharge parameters or other settings to a Huawei device via Modbus - Build a local energy management system that queries multiple inverter registers in a single batch operation ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a Python interface to read and write data from Huawei SUN2000 inverters and LUNA2000 batteries over Modbus-TCP or Modbus-RTU, with support for batched register reads, unit conversion, and installer-level access. Yes, if you own or manage Huawei SUN2000 inverters or LUNA2000 batteries and need local Modbus access. The package is actively maintained, has no known vulnerabilities, low install friction, and is marked Production/Stable. The AGPL v3 license is permissive for local use but requires source disclosure if you deploy modified versions as a network service. Not suitable if you need Python versions below 3.12. ## Install pip install huawei-solar uv add huawei-solar poetry add huawei-solar ## Installing huawei-solar Before you install: Low install friction with a single runtime dependency (tmodbus). Actively maintained with a release 3 days old and recent commits; marked Production/Stable. License in practice: Licensed under GNU Affero General Public License v3, which requires that if you modify and deploy this library as a network service, you must provide source code access to users. For local use or as a library in your own application, the copyleft obligation applies only if you distribute modified versions. Quickstart: import asyncio from huawei_solar import create_tcp_client, create_device_instance, SUN2000Device from huawei_solar import register_names as rn async def read_inverter(): client = create_tcp_client(host="192.168.1.1", port=503) device = await create_device_instance(client) result = await device.batch_update([rn.INPUT_POWER, rn.LINE_VOLTAGE_A_B]) print(result) asyncio.run(read_inverter()) Requires Python 3.12 or later. Huawei devices support only one connection at a time; concurrent connections from other clients will interrupt your session. Verify before relying: - Whether tmodbus has known vulnerabilities or maintenance issues not reflected in this package's security record - Performance characteristics when reading large batches of registers or handling network latency - Compatibility with specific SUN2000 firmware versions beyond the Huawei Modbus Interface Definitions ## Package facts - License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this… (full text in the JSON record) (agpl) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 136.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags huawei inverter modbus, sun2000 solar monitoring, modbus tcp rtu client, battery inverter control, home automation solar, solar-energy, modbus-protocol, home-automation [View on SkillFed](https://skillfed.io/packages/huawei-solar) · [View on PyPI](https://pypi.org/project/huawei-solar/)