This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Modbus Goodwe
#15
(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...
Code:
ip = '192.168.1.179'
GroupAddresses = '32/1/'

require('luamodbus')
mb = luamodbus.tcp()
mb:open(ip, 502)
res, err = mb:connect()
mb:setslave(1) -- Inverter

Inverter_rated_power = mb:readregistervalue(35001,'uint16')
Grid_connection_status = mb:readregistervalue(35136,"uint16")
Total_INV_Power = mb:readregistervalue(35137,'int32')
AC_ActivePower = mb:readregistervalue(35139,'int32')
Total_Back_Up = mb:readregistervalue(35169,'int32')
Total_Load_power  = mb:readregistervalue(35171,'int32')
Ups_Load_Percent = mb:readregistervalue(35173,'uint16')
Inverter_Internal_Temperature = mb:readregistervalue(35174,'int16')
Inverter_Unit_Temperature = mb:readregistervalue(35175,'int16')
Inverter_Heat_Sink_Temperature = mb:readregistervalue(35176,'int16')
Battery1_Mode = mb:readregistervalue(35184,'uint16')
Work_Mode = mb:readregistervalue(35187,'uint16')
Error_Message = mb:readregistervalue(35189,"uint32")
PV_E_Day = mb:readregistervalue(45224,'uint32')
E_Day_Sell = mb:readregistervalue(45230,'uint16')
E_Day_Buy = mb:readregistervalue(45231,'uint32')
Meter_L1_Active_Power  = mb:readregistervalue(36019,'int32')
Meter_L2_Active_Power  = mb:readregistervalue(36021,'int32')
Meter_L3_Active_Power  = mb:readregistervalue(36023,'int32')
Meter_Total_Active_Power  = mb:readregistervalue(36025,'int32')
E_Total_Sell = mb:readregistervalue(45226,'uint32')
E_Total_Buy = mb:readregistervalue(45231,'uint32')
Battery_Mode_PV_Charge_Enable = mb:readregistervalue(45278,'uint16')
App_Mode_Index = mb:readregistervalue(47000,'uint16')
Start_Charge_SOC = mb:readregistervalue(47531,'uint16')
Stop_Charge_SOC = mb:readregistervalue(47532,'uint16')
Fast_Charge_Enable = mb:readregistervalue(47545,'uint16')
Fast_Charge_Stop_SOC = mb:readregistervalue(47546,'uint16')
Battery_SOC = mb:readregistervalue(37007,'uint16')
EMSPowerMode = mb:readregistervalue(47511,'uint16')
EMSPowerSet = mb:readregistervalue(47512,'uint16')
--FeedPowerEnable = mb:readregistervalue(47509,'int16')
--log(FeedPowerEnable)
--FeedPowerPara = mb:    readregistervalue(47510,'int16')
--log(FeedPowerPara)
--Model_Name = mb:readregistervalue(35182,'uint32')
--log(Model_Name)
--Model_Name2 = mb:readregisters(35012,1)
--log(Model_Name2)
--Model_Name3 = mb:readregisters(35013,1)
--log(Model_Name3)
--Model_Name4 = mb:readregisters(35014,1)
--log(Model_Name4)
--wBMSBatSOC = mb:readregistervalue(47908,'uint16')
BMS_Pack_Temperature = mb:readregistervalue(37003,'uint16')

mb:close() 

grp.checkupdate(GroupAddresses .. '1', Inverter_rated_power)
grp.checkupdate(GroupAddresses .. '2', Grid_connection_status)
grp.checkupdate(GroupAddresses .. '3', Total_INV_Power/1000)
grp.checkupdate(GroupAddresses .. '4', AC_ActivePower/1000)
grp.checkupdate(GroupAddresses .. '5', Total_Back_Up/1000)
grp.checkupdate(GroupAddresses .. '6', Total_Load_power/1000)
grp.checkupdate(GroupAddresses .. '7', Ups_Load_Percent)
grp.checkupdate(GroupAddresses .. '8', Inverter_Internal_Temperature/10)
grp.checkupdate(GroupAddresses .. '9', Inverter_Unit_Temperature/10)
grp.checkupdate(GroupAddresses .. '10', Inverter_Heat_Sink_Temperature/10)
grp.checkupdate(GroupAddresses .. '11', Battery1_Mode)
grp.checkupdate(GroupAddresses .. '12', Work_Mode)
grp.checkupdate(GroupAddresses .. '13', Error_Message)
grp.checkupdate(GroupAddresses .. '14', PV_E_Day/10)
grp.checkupdate(GroupAddresses .. '15', E_Day_Sell/10)
grp.checkupdate(GroupAddresses .. '16', E_Day_Buy/10)
grp.checkupdate(GroupAddresses .. '17', Meter_Total_Active_Power/1000)
grp.checkupdate(GroupAddresses .. '18', E_Total_Sell/10)
grp.checkupdate(GroupAddresses .. '19', E_Total_Buy/10)
grp.checkupdate(GroupAddresses .. '20', Battery_Mode_PV_Charge_Enable)
grp.checkupdate(GroupAddresses .. '21', App_Mode_Index)
grp.checkupdate(GroupAddresses .. '22', Start_Charge_SOC)
grp.checkupdate(GroupAddresses .. '23', Stop_Charge_SOC)
grp.checkupdate(GroupAddresses .. '24', Fast_Charge_Enable)
grp.checkupdate(GroupAddresses .. '25', Fast_Charge_Stop_SOC)
grp.checkupdate(GroupAddresses .. '26', Battery_SOC)
grp.checkupdate(GroupAddresses .. '27', EMSPowerMode)
grp.checkupdate(GroupAddresses .. '28', EMSPowerSet)
grp.checkupdate(GroupAddresses .. '31', BMS_Pack_Temperature/10)
grp.checkupdate(GroupAddresses .. '32', Meter_L1_Active_Power/1000)
grp.checkupdate(GroupAddresses .. '33', Meter_L2_Active_Power/1000)
grp.checkupdate(GroupAddresses .. '34', Meter_L3_Active_Power/1000)

Maybe it helps

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.
Reply


Messages In This Thread
Modbus Goodwe - by Amelie - 16.10.2023, 12:28
RE: Modbus Goodwe - by Daniel - 16.10.2023, 12:40
RE: Modbus Goodwe - by Amelie - 16.10.2023, 18:18
RE: Modbus Goodwe - by 1danny - 16.10.2023, 18:59
RE: Modbus Goodwe - by Amelie - 16.10.2023, 19:13
RE: Modbus Goodwe - by 1danny - 16.10.2023, 19:46
RE: Modbus Goodwe - by Amelie - 16.10.2023, 20:02
RE: Modbus Goodwe - by Amelie - 18.10.2023, 18:22
RE: Modbus Goodwe - by admin - 19.10.2023, 06:54
RE: Modbus Goodwe - by fleeceable - 19.10.2023, 10:00
RE: Modbus Goodwe - by Amelie - 22.10.2023, 19:28
RE: Modbus Goodwe - by fleeceable - 23.10.2023, 09:54
RE: Modbus Goodwe - by Amelie - 23.10.2023, 16:04
RE: Modbus Goodwe - by fleeceable - 23.10.2023, 16:19
RE: Modbus Goodwe - by Amelie - 24.10.2023, 09:57
RE: Modbus Goodwe - by fleeceable - 24.10.2023, 19:57
RE: Modbus Goodwe - by Amelie - 27.10.2023, 17:46
RE: Modbus Goodwe - by Amelie - 19.10.2023, 13:43
RE: Modbus Goodwe - by Amelie - 20.10.2023, 12:05
RE: Modbus Goodwe - by Daniel - 20.10.2023, 14:35
RE: Modbus Goodwe - by Amelie - 21.10.2023, 14:21
RE: Modbus Goodwe - by 1danny - 23.10.2023, 06:55

Forum Jump: