Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
This library implements an easy to use interface to locally connect to Huawei SUN2000 inverters over Modbus-TCP or Modbus-RTU following the 'Solar Inverter Modbus Interface Definitions' provided by Huawei.
It was primarily developed to add support for Huawei Solar inverters to Home Assistant, resulting in the following integration: wlcrs/huawei_solar.
Features:
SUN2000-<serial_no>
)
broadcasted by the inverterNote t
This library is published on PyPI:
pip3 install huawei-solar
The library consists out of a low level interface implemented in huawei_solar.py which implements all the Modbus-operations, and a high level interface in bridge.py which facilitates easy usage (primarily meant for the HA integration).
An example on how to read the most interesting registers from the inverter:
bridge = await HuaweiSolarBridge.create(host="192.168.200.1", port=6607)
print(await bridge.batch_update([rn.INPUT_POWER, rn.LINE_VOLTAGE_A_B, rn.LINE_VOLTAGE_B_C, rn.LINE_VOLTAGE_C_A]))
This results in the following output being printed:
{'input_power': Result(value=82, unit='W'), 'line_voltage_A_B': Result(value=233.4, unit='V'), 'line_voltage_B_C': Result(value=0.0, unit='V'), 'line_voltage_C_A': Result(value=0.0, unit='V')}
Example code:
from huawei_solar import AsyncHuaweiSolar, register_names as rn
slave_id = 0
client = await AsyncHuaweiSolar.create("192.168.200.1", 6607, slave_id)
# Reading a single register
result = await bridge.client.get(rn.NB_PV_STRINGS, slave_id)
print("Number of PV strings: ", result.value)
# Batched reading of multiple registers
# Only possible when they are located closely to each other in the Modbus register space
results = await self.client.get_multiple([rn.LINE_VOLTAGE_A_B, rn.LINE_VOLTAGE_B_C, rn.LINE_VOLTAGE_C_A], self.slave_id)
print("A-B voltage: ", results[0].value)
print("B-C voltage: ", results[1].value)
print("C-A voltage: ", results[2].value)
A good starting point to learn how to use the low level interface is to look at how the high level interface in bridge.py uses it.
The initial implementation of v1 was done by @Emilv2.
Subsequent development on v2 was done by @wlcrs.
FAQs
A Python wrapper for the Huawei Inverter modbus TCP API
We found that huawei-solar demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.