U32 (uint32) is 4 byte unsigned integer, U16 (uint16) is 2 byte unsigned integer. Default swap in LM is w (word). Use read test to check if you a different swap is needed.
You might need to use a different datatype like 4 byte floating point on LM side if the register value is scaled (x10, x100 etc). Otherwise the fractional part will be lost when using an integer data type.
I have established successfully communication with Goodwe GW10K-ET and battery pack BYD 22kWh . Gonna post script here. Since it is taken from backup you maybe need to modify a bit but it should work...
19.10.2023, 13:43 (This post was last modified: 19.10.2023, 17:03 by Amelie.)
Thank you for the script. It works. What, I mean with that: I get no errors and I get values.
But, with what I'm still struggeling: the values doesn't correspond with the values I get in Semsportal or the values I get with an API-call. What could be the cause of that? If I want to see the output of the inverter, at which variable should I look?
The funny thing is, that when I look to 'PV_E_Dag', the value is the same for the Modbus, API and Semsportal. Thus, this is correct.
20.10.2023, 12:05 (This post was last modified: 20.10.2023, 12:14 by Amelie.)
Thank you for for all the help I received the past days. They were very helpful.
I mailed to Goodwe for there last Modbus register, and after signing a NDA, I got it. It seems that the register didn't change. So, the problem must be found elsewhere.
I know that there is always a delay on the API, so having matching values is practically impossible, but I noticed that if I log the values in the script, they change the whole time. But, the address aren't updated. So, the code
Are you sure the value is actually changing? grp.checkupdate will update value only on change. You can change it to grp.update to see if value is updated.
I think that now everything works. The values of the Modbus differs a bit from those from the API. But on those received from the API, there is some delay and they are not always updated. (I think the server is China is sometimes slow )
But, now and then, I get an error (see attachment). Not much, I got one error since yesterday evening. It is caused by an error in the way I have implemented it, or is it caused by the inverter?
(19.10.2023, 10:00)fleeceable Wrote: I have established successfully communication with Goodwe GW10K-ET and battery pack BYD 22kWh . Gonna post script here. Since it is taken from backup you maybe need to modify a bit but it should work...
Thank you, it helped a lot. Now, I can force the inverted to load the battery by writing a value to register 'Stop_Charge_SOC' (register 47532). But, when I write the same value to 'Start_Charge_SOC' (register 47531), I thought that he wouldn't discharge. But, my thoughts were wrong. Do you have an idea to what register I have to write, to stop discharging the battery?
I want to load my battery, in winter when the electricity prices are low and discharge them when the prices are high.
(19.10.2023, 10:00)fleeceable Wrote: I have established successfully communication with Goodwe GW10K-ET and battery pack BYD 22kWh . Gonna post script here. Since it is taken from backup you maybe need to modify a bit but it should work...
Thank you, it helped a lot. Now, I can force the inverted to load the battery by writing a value to register 'Stop_Charge_SOC' (register 47532). But, when I write the same value to 'Start_Charge_SOC' (register 47531), I thought that he wouldn't discharge. But, my thoughts were wrong. Do you have an idea to what register I have to write, to stop discharging the battery?
I want to load my battery, in winter when the electricity prices are low and discharge them when the prices are high.
I'm using these registers to control battery:
mb:writeregisters(47511, EMSPowerModeWrite) - 2 charge, 3 discharge, 1 auto/self use mode
mb:writeregisters(47512, EMSPowerSetWrite) - charging/discharging power (in watts)
23.10.2023, 16:04 (This post was last modified: 23.10.2023, 16:04 by Amelie.)
(23.10.2023, 09:54)fleeceable Wrote: I'm using these registers to control battery:
mb:writeregisters(47511, EMSPowerModeWrite) - 2 charge, 3 discharge, 1 auto/self use mode
mb:writeregisters(47512, EMSPowerSetWrite) - charging/discharging power (in watts)
Modes are described in attachment
So, during night, I have to set the register 47511 to 1 and at 6 o'clock (when the electricity prices are higher) I have to write 0 to register 47511. Will the battery automatically stop when it reaches 100% or, do I have to time it?
23.10.2023, 16:19 (This post was last modified: 23.10.2023, 16:27 by fleeceable.)
(23.10.2023, 16:04)Amelie Wrote:
(23.10.2023, 09:54)fleeceable Wrote: I'm using these registers to control battery:
mb:writeregisters(47511, EMSPowerModeWrite) - 2 charge, 3 discharge, 1 auto/self use mode
mb:writeregisters(47512, EMSPowerSetWrite) - charging/discharging power (in watts)
Modes are described in attachment
So, during night, I have to set the register 47511 to 1 and at 6 o'clock (when the electricity prices are higher) I have to write 0 to register 47511. Will the battery automatically stop when it reaches 100% or, do I have to time it?
It's basically in charging mode and if battery is full, system gonna hold battery on 100%. If no sun then only house usage is imported from grid.
Short answer you don't need to time it.
But double check values. These are on hex. If you try to write 0 in that register you probably get error...
If electricity is cheap - write 2 - you gonna buy
If price is high and you want to sell back to grid (in summer time) before sun - write 3
If you want to use electricity from battery to supply home usage - write 1
If you want to hold battery state then you can write 8 - so battery gonna be on standby
(23.10.2023, 16:19)fleeceable Wrote: So, during night, I have to set the register 47511 to 1 and at 6 o'clock (when the electricity prices are higher) I have to write 0 to register 47511. Will the battery automatically stop when it reaches 100% or, do I have to time it?
It's basically in charging mode and if battery is full, system gonna hold battery on 100%. If no sun then only house usage is imported from grid.
Short answer you don't need to time it.
But double check values. These are on hex. If you try to write 0 in that register you probably get error...
If electricity is cheap - write 2 - you gonna buy
If price is high and you want to sell back to grid (in summer time) before sun - write 3
If you want to use electricity from battery to supply home usage - write 1
If you want to hold battery state then you can write 8 - so battery gonna be on standby
Thank you for your help. I appreciate it very much!
But, I still have some question:
The register 35137 seems to be the sum of the solar panels and the power to the battery. I suppose the register 35171 is the one the battery. But which register does I have to call to have only the power of the solar panels?
Now, when the battery is discharging, is goes to an SOC of 5%. I want to avoid it, because on a raining day, instantaneous total power to the grid is high (together with the consumption of the house at that moment) and in Belgium some cost are bases on the peak values. So, I want to stop the discharging at 10%. I was trying to change the register 47351, but nothing happens. I was looking for the comparable BMS register, but I didn't find it. To which register, I have to write to top discharging at 10%?
(since in the manual there is written: set the SOC level to start/stop battery force charge. (this is not the command from BMS, but the protection on inverter side. Eg. StartchgSOC (47531) is set as 5%, but the battery BMS gives a force charge signal at SOC 6%, then battery will start force charge at 6% SOC; if BMS does not send force charge command at 5% SOC, then battery will still start force charge at 5% SOC. )