deye-controller icon indicating copy to clipboard operation
deye-controller copied to clipboard

High word registers for HoldingRegisters.GRIDTotalPower on SUN-50K

Open norbislv opened this issue 5 months ago • 1 comments

Thank you for writing this library, it really helped getting started on reading inverter I have. I'll preface that I might missing something due of lack of skill.

Issue: HoldingRegisters.GRIDTotalPower reports wrong value when using python library when grid power is greater than 16 bit value or ~64kW.

Grid total power consists of two registers 625 for low word and 690 for high word. Looking at protocol.py and testing, it seems that HoldingRegisters.GRIDTotalPower reads only the low word and I cannot find the counterpart for 690.

The same is likely true for HoldingRegisters.LoadTotalPower and probably others.

While the correct value can be read reading registers directly and probably impacts few users of library, so maybe not worth changing, it might be good idea to note the >64kW issue somewhere in case someone else runs into this.

norbislv avatar Jul 03 '25 08:07 norbislv

Hi,

This is not the first complain about the larger inverters e.g. the custom_format() method has been added due to some scaling issues with them.

Grid total power consists of two registers 625 for low word and 690 for high word. Looking at protocol.py and testing, it seems that HoldingRegisters.GRIDTotalPower reads only the low word and I cannot find the counterpart for 690.

Yes, because the SUN-12K-SG04LP3 uses only one register, and the V100 version of the documentation (this library was built around it) does not mention the second one at all. They were added in a later revision.

The same is likely true for HoldingRegisters.LoadTotalPower and probably others.

Yes, a few others, they (low/high word) are separated by color in version V105 of the documentation (which actually is available even here).

The changes in 3f5e2ca should help with such registers, but you will have to add/define them. Small example below:

from deye_controller.utils.monkey_patch import monkey_patch
from deye_controller.modbus.protocol import LongNCType
from pysolarmanv5 import PySolarmanV5

monkey_patch()

GridTotalPower = LongNCType(625, 690, 'grid_total_power', scale=1, suffix='W')
sol = PySolarmanV5('192.168.1.121', 2712345678, auto_reconnect=True, verbose=True)
sol.read_holding_registers(GridTotalPower)
GridTotalPower.format()
...

githubDante avatar Jul 03 '25 23:07 githubDante