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

Modbus control of import and export power

Open HarmvandenBrink opened this issue 1 year ago • 8 comments

Would it be possible to control the import and export power of the DEYE inverter using Modbus?

Can we do this per phase, or as total amount?

Could you help me out with this, you’re sort of my last resort.

HarmvandenBrink avatar Nov 05 '24 17:11 HarmvandenBrink

It's doable via the following registers:

  • MaxChargeAmps
  • MaxDischargeAmps or
  • GridExportLimit

All are available in the WritableRegisters class. The latter is even mentioned at the bottom of the README.

githubDante avatar Nov 05 '24 17:11 githubDante

Sorry that I missed that. I thought it are limits that are set, not actual set points for the inverter

HarmvandenBrink avatar Nov 05 '24 17:11 HarmvandenBrink

I would like to know the same thing. With other systems I am used to writing a power setpoint (either a positive or negative value depending on discharge/charge).

So I think my question is: if I just want to charge or discharge the battery right now with a certain amount of power, what commands do I need to send? This seems like a very basic functionality but I cannot find the correct commands/steps when looking at the documentation.

tonsmets avatar Nov 06 '24 08:11 tonsmets

So I think my question is: if I just want to charge or discharge the battery right now with a certain amount of power, what commands do I need to send? This seems like a very basic functionality but I cannot find the correct commands/steps when looking at the documentation.

You should use the programmer with the correct time interval, power & SOC settings. Also make sure that the TimeOfUse (register 146) shows Enabled and at least the current day of the week is also in the list.

TimeOfUse example from deye-read:

[                   Sell_Time_Of_Use]: ['TimeOfUse - ENABLED', 'TimeOfUse - MONDAY', 'TimeOfUse - TUESDAY', 'TimeOfUse - WEDNESDAY', 'TimeOfUse - THURSDAY', 'TimeOfUse - FRIDAY', 'TimeOfUse - SATURDAY', 'TimeOfUse - SUNDAY'] 

Edit: If you want to charge the battery, the SOC value in the programmer must be set above the current battery SOC value and vice versa if you want discharge the SOC in the programmer must be set lower than the current battery SOC.

githubDante avatar Nov 06 '24 10:11 githubDante

Specifically regarding import, is setting the MaxChargeAmps the only way of doing this?

What if I want to charge at exactly 3450W? The resulting import power would be:

$P = \text{BatteryVoltage} \times \text{MaxChargeAmps}$

This basically means that I will have to live with $\pm\frac{\text{BatteryVoltage}}{2}$ (ish) in worst case scenario, no?

Registers (holding): 108 - MaxChargeAmps (R/W) 587 - Battery Voltage (R) (scale factor 10, or register 10003 with no scale factor)

Also, seems like there is a register (233) for max import power, but I can't seem to modify it despite it being a R/W:

Image

davmoz avatar Mar 24 '25 19:03 davmoz

Hi,

Which inverter is the cited documentation for ? MaxChargeAmps looks like the only way. Registers 210 & 212 are not an option as they are controlled by the BMS (at least in my case). Any value written there is overwritten after a few seconds with no effect on the charge/discharge rate.

You need 61-62 amps with a 56V battery in order to charge it with 3450W/h (${P}/{BatteryVoltage}$).

githubDante avatar Mar 24 '25 21:03 githubDante

Which inverter is the cited documentation for ?

Apologies, here comes the setup and the doc:

Inverter(s): SUN-5/6/8/10/12/15/20/25K-SG01HP3-EU-AM2 Battery module: GB-LM4.0 Docs (translated with DeepL): deye_MODBUS RTU_V105.3-20240710-Lee_Dobson en.pdf

Also, I'm reading 6365.0 from register 587, so 636.50V.

davmoz avatar Mar 25 '25 07:03 davmoz

So, this is a new version of the RTU documentation with a few additions for high voltage batteries/inverters. Thanks for sharing it. Considering the notes in the changelog (Add customized register) and the position of these registers (231-233) they are probably BMS related. 233 does not accept values in the LP/LV version too.

githubDante avatar Mar 25 '25 13:03 githubDante