Skip to main content

Huawei Solar Tools

Huawei Solar Tools is a Python library for interacting with Huawei solar inverters, batteries, power meters, and energy management interfaces (EMI) using Modbus TCP.

It provides methods to read and write Modbus registers, retrieve operational data, and interpret register values.

Functionality

  • Establishes Modbus TCP communication with Huawei solar devices.
  • Reads and writes Modbus registers.
  • Retrieves device status, operational parameters, and alarms.
  • Converts raw register values into structured data.
  • Supports multiple devices in parallel.

Target Users

  • Developers integrating Huawei solar devices into software systems.
  • System administrators managing solar installations.
  • Data engineers handling time-series data from Huawei devices.

Features

📡 Communication

  • Modbus TCP client for interacting with Huawei solar equipment.
  • Multi-device support.

🔍 Data Retrieval

  • Reads real-time data from inverters, batteries, and meters.
  • Fetches system status, alarms, and operational parameters.
  • Reads raw registers and interprets their values.

🔧 Register Processing

  • Decodes bitfields, integers, floats, and string registers.
  • Converts raw Modbus register values into structured formats.

📊 Database Integration (User Implementation)

  • Compatible with ClickHouse and InfluxDB for data storage (not required for core library).

Installation

Huawei Solar Tools requires Python 3.9+.

Install via PyPI:

pip install huawei-solar-tools

Install from source:

git clone https://github.com/atrabilis/huawei-solar-tools.git
cd huawei-solar-tools
pip install .

Usage

The following examples demonstrate how to use the Huawei Solar Tools library for basic interactions.
For more detailed examples, refer to the scripts in the tests/ directory.

1️⃣ Initialize a Connection to a Huawei Inverter

from huawei_solar_tools.devices.inverter import Inverter

# Define connection parameters
host = "192.168.1.100"
port = 502
device_id = 1

# Initialize the inverter
inverter = Inverter(host, port, device_id)

async def main():
    await inverter.connect()
    print(f"Device ID: {inverter.get_device_id()}")
    print("All Registers:", await inverter.read_all_registers())
    await inverter.disconnect()

import asyncio
asyncio.run(main())

Supported Devices and Compatibility

Huawei Solar Tools is designed to interact with the following Huawei solar devices via the Modbus TCP protocol. Compatibility is based on the firmware and device models specified in the Huawei Modbus documentation.

1️⃣ Inverters

  • Supported Models: SUN2000 Series
    • Example Models: SUN2000-33KTL, SUN2000-60KTL, SUN2000-100KTL
  • Firmware Requirements: V100R001C00SPC200 or later

2️⃣ Batteries

  • Supported Models:
    • LUNA2000: LUNA2000-5, LUNA2000-10
    • LG-RESU: LG-RESU10H
  • Firmware Requirements: V200R002C10SPC100 or later

3️⃣ Power Meters

  • Supported Models:
    • DDSU666-H
    • DTSU666-H
  • Features:
    • Measures phase voltages, currents, active/reactive power, and total energy.
    • Registers include power factor, phase-by-phase power, and total energy consumption.

4️⃣ Energy Management Interfaces (EMI)

  • Supported Features:
    • Environmental monitoring (wind speed, wind direction, temperature, irradiance).
    • Supports data logging and integration with Huawei SmartLogger.
  • Firmware Requirements: V200R002C20 or later

5️⃣ SmartLogger

  • Supported Models:
    • SmartLogger3000
    • SmartLogger2000
  • Firmware Requirements: V100R001C00 or later
  • Features:
    • Supports data collection and communication with multiple Huawei devices.
    • Provides power control, alarm management, and device synchronization via Modbus.

References

  1. Huawei Technologies Co., Ltd. SmartLogger Modbus Interface Definitions, Issue 35. 2020. Proprietary documentation.
  2. Huawei Technologies Co., Ltd. Solar Inverter Modbus Interface Definitions, Issue 5. 2020. Proprietary documentation.

Contributing

Contributions to Huawei Solar Tools are welcome! Follow the steps below to contribute to the project:

Step Description Commands/Details
1. Fork Create a personal copy of the repository. Click the Fork button on the repository's GitHub page.
2. Clone Clone the forked repository to your local machine. bash<br>git clone https://github.com/YOUR_USERNAME/huawei-solar-tools.git<br>cd huawei-solar-tools<br>
3. Branch Create a new branch for your changes. bash<br>git checkout -b feature-new-functionality<br>
4. Develop Make your changes following the current structure and conventions of the codebase. - Keep your code readable and consistent.
- Add docstrings where appropriate to explain functionality.
5. Test (if applicable) Verify your changes using the provided test scripts in the tests/ directory or you can make your own less ad hoc more proffesional tests. bash<br>python tests/test_inverter.py<br>
6. Commit Stage and commit your changes with a descriptive message. bash<br>git add .<br>git commit -m "Add new functionality for inverters"<br>
7. Push Push your changes to your forked repository. bash<br>git push origin feature-new-functionality<br>
8. Pull Request Open a pull request to the main repository. Provide a clear description of your changes and their purpose.

For questions or clarifications, feel free to open an issue.

License

This project is licensed under the MIT License. You are free to use, modify, and distribute this software, provided that the original copyright notice and permission notice are included in all copies or substantial portions of the software.

For detailed licensing information, refer to the LICENSE file in the repository.

Future Work

A lot of improvements and features are planned for Huawei Solar Tools like optimizers reading and write operations. A detailed roadmap will be posted in the future.

Metadata

Release files for huawei-solar-tools 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for huawei-solar-tools 0.1.5
File Size Uploaded Provenance Actions
huawei_solar_tools-0.1.5.tar.gz 34.0 kB Without provenance Details for huawei_solar_tools-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for huawei-solar-tools 0.1.5
File Interpreter ABI Platform Actions
huawei_solar_tools-0.1.5-py3-none-any.whl Python 3 none any Details for huawei_solar_tools-0.1.5-py3-none-any.whl

Total release size: 79.4 kB

Release files / huawei_solar_tools-0.1.5.tar.gz

Download URL huawei_solar_tools-0.1.5.tar.gz
Size 34.0 kB
Tags Source
SHA-256 checksum
How to use checksums
47dfdfbcfeae2512ef704f911ad60544f282f85f7873bde9e9e56535e342fd48
BLAKE2b-256 checksum
How to use checksums
f76cfb0ff3eb45bef5555310e29efd4c76bb7a6d73fea4172b8bd495cd612635
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.22

Release files / huawei_solar_tools-0.1.5-py3-none-any.whl

Download URL huawei_solar_tools-0.1.5-py3-none-any.whl
Size 45.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
775bcb4efea82ac80a8d5eb488bccc4f7d34b026bc1b72bd6140682172146dc0
BLAKE2b-256 checksum
How to use checksums
3f100acf482ab6a9e291c3b963849d7cafeef22c9a3c75dad8166a6350689eca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.22

Security for huawei-solar-tools 0.1.5

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page