Skip to content

Commit 5450366

Browse files
committed
remote_control: fix invalid registers, add h180 registers
1 parent 334e51a commit 5450366

File tree

3 files changed

+31
-17
lines changed

3 files changed

+31
-17
lines changed

custom_components/foxess_modbus/entities/modbus_remote_control_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ class ModbusRemoteControlAddressConfig:
4545
"""Configured Max SoC"""
4646
invbatpower: list[int]
4747
"""Current battery charge (negative) / discharge (positive) power"""
48-
pwr_limit_bat_up: list[int] | None
49-
"""Prw_limit Bat_up, maximum power that the battery can accept"""
48+
pwr_limit_bat_down: list[int] | None
49+
"""Prw_limit Bat_down, maximum power that the battery can accept"""
5050
pv_voltages: list[int]
5151
"""Array of pvx_voltage addresses for PV strings"""
5252

custom_components/foxess_modbus/entities/remote_control_description.py

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
max_soc=41010,
2323
invbatpower=[11008],
2424
battery_soc=[11036],
25-
pwr_limit_bat_up=[44012],
25+
pwr_limit_bat_down=[44012],
2626
pv_voltages=[11000, 11003],
2727
),
2828
models=Inv.H1_G1,
@@ -38,7 +38,7 @@
3838
max_soc=None,
3939
invbatpower=[31022],
4040
battery_soc=[31024],
41-
pwr_limit_bat_up=None,
41+
pwr_limit_bat_down=None,
4242
pv_voltages=[31000, 31003],
4343
),
4444
models=Inv.H1_LAN,
@@ -53,7 +53,7 @@
5353
max_soc=41010,
5454
invbatpower=[31022],
5555
battery_soc=[31024],
56-
pwr_limit_bat_up=None,
56+
pwr_limit_bat_down=None,
5757
pv_voltages=[39070, 39072],
5858
),
5959
models=Inv.H1_G2_SET,
@@ -69,7 +69,7 @@
6969
max_soc=41010,
7070
invbatpower=[11008],
7171
battery_soc=[11036],
72-
pwr_limit_bat_up=None,
72+
pwr_limit_bat_down=None,
7373
# Exists, but see https://github.com/nathanmarlor/foxess_modbus/discussions/666
7474
pv_voltages=[11000, 11003, 11096, 11099],
7575
),
@@ -85,13 +85,13 @@
8585
max_soc=41010,
8686
invbatpower=[31022],
8787
battery_soc=[31024],
88-
pwr_limit_bat_up=None,
88+
pwr_limit_bat_down=None,
8989
pv_voltages=[31000, 31003, 31039, 31042],
9090
),
9191
models=Inv.KH_PRE133 | Inv.KH_133,
9292
),
9393
RemoteControlAddressSpec(
94-
# The H3 doesn't support anything above 44005, and the active/reactive power regisers are 2 values
94+
# The H3 before 1.80 doesn't support anything above 44005, and the active/reactive power regisers are 2 values
9595
# The Kuara H3 doesn't support this, see https://github.com/nathanmarlor/foxess_modbus/issues/532
9696
holding=ModbusRemoteControlAddressConfig(
9797
remote_enable=44000,
@@ -100,16 +100,30 @@
100100
work_mode=41000,
101101
work_mode_map=_NORMAL_WORK_MODE_MAP,
102102
max_soc=41010,
103-
invbatpower=[31022],
103+
invbatpower=[31036],
104104
battery_soc=[31038],
105-
pwr_limit_bat_up=None,
105+
pwr_limit_bat_down=None,
106106
pv_voltages=[31000, 31003],
107107
),
108-
models=Inv.H3_SET & ~Inv.KUARA_H3 & ~Inv.AIO_H3_101 & ~Inv.AIO_H3_PRE101,
108+
models=Inv.H3_PRE180 & ~Inv.KUARA_H3 & ~Inv.AIO_H3_101 & ~Inv.AIO_H3_PRE101,
109+
),
110+
RemoteControlAddressSpec(
111+
# H3 after 180 supports pwr_limit_bat_down
112+
holding=ModbusRemoteControlAddressConfig(
113+
remote_enable=44000,
114+
timeout_set=44001,
115+
active_power=[44003, 44002],
116+
work_mode=41000,
117+
work_mode_map=_NORMAL_WORK_MODE_MAP,
118+
max_soc=41010,
119+
invbatpower=[31036],
120+
battery_soc=[31038],
121+
pwr_limit_bat_down=[44012],
122+
pv_voltages=[31000, 31003],
123+
),
124+
models=Inv.H3_180,
109125
),
110126
RemoteControlAddressSpec(
111-
# The H3 doesn't support anything above 44005, and the active/reactive power regisers are 2 values
112-
# The Kuara H3 doesn't support this, see https://github.com/nathanmarlor/foxess_modbus/issues/532
113127
holding=ModbusRemoteControlAddressConfig(
114128
remote_enable=46001,
115129
timeout_set=46002,
@@ -123,7 +137,7 @@
123137
max_soc=46610,
124138
invbatpower=[39238, 39237],
125139
battery_soc=[37612, 38310],
126-
pwr_limit_bat_up=[46019, 46018],
140+
pwr_limit_bat_down=[46021, 46020],
127141
pv_voltages=[39070, 39072, 39074, 39076, 39078, 39080],
128142
),
129143
models=Inv.H3_PRO_SET | Inv.H3_SMART,

custom_components/foxess_modbus/remote_control_manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def __init__(
3434
self._addresses.work_mode,
3535
self._addresses.max_soc,
3636
*self._addresses.invbatpower,
37-
*(self._addresses.pwr_limit_bat_up if self._addresses.pwr_limit_bat_up is not None else []),
37+
*(self._addresses.pwr_limit_bat_down if self._addresses.pwr_limit_bat_down is not None else []),
3838
*self._addresses.pv_voltages,
3939
]
4040
self._modbus_addresses = [x for x in modbus_addresses if x is not None]
@@ -160,7 +160,7 @@ async def _update_charge(self) -> None:
160160
# we have enough PV to cover charge and part of house load, it'll cover the load in full then part of the
161161
# charge).
162162
#
163-
# A better way seems to be to use the Pwr_limit_Bat_up register. This seems to hold the maximum input power
163+
# A better way seems to be to use the Pwr_limit_Bat_down register. This seems to hold the maximum input power
164164
# that the battery can take, including things like BMS limits (which might not be exposed by the inverter,
165165
# depending on model). Therefore we can control the actual battery charge power so it's slightly below the
166166
# limit: this means that PV isn't being clipped (as it would fill the gap if it was).
@@ -184,7 +184,7 @@ async def _update_charge(self) -> None:
184184

185185
# These are both negative
186186
# max_battery_charge_power_negative isn't available on the H1 over LAN
187-
max_battery_charge_power_negative = self._read(self._addresses.pwr_limit_bat_up, signed=True)
187+
max_battery_charge_power_negative = self._read(self._addresses.pwr_limit_bat_down, signed=True)
188188
current_battery_charge_power_negative = self._read(self._addresses.invbatpower, signed=True)
189189
if max_battery_charge_power_negative is None or current_battery_charge_power_negative is None:
190190
_LOGGER.debug(

0 commit comments

Comments
 (0)