Skip to content

Commit

Permalink
Merge pull request #740 from canton7/feature/new-kh
Browse files Browse the repository at this point in the history
Add KH version 1.33 (thanks to @ocl80)
  • Loading branch information
canton7 authored Jan 26, 2025
2 parents b5a7cf1 + 54890a5 commit 094fcfe
Show file tree
Hide file tree
Showing 8 changed files with 1,118 additions and 92 deletions.
5 changes: 3 additions & 2 deletions custom_components/foxess_modbus/common/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ class Inv(Flag):
H1_G2 = auto()

KH_PRE119 = auto()
KH_119 = auto()
KH_SET = KH_PRE119 | KH_119
KH_PRE133 = auto()
KH_133 = auto()
KH_SET = KH_PRE119 | KH_PRE133 | KH_133

H3 = auto()
AIO_H3 = auto()
Expand Down
242 changes: 158 additions & 84 deletions custom_components/foxess_modbus/entities/entity_descriptions.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def __post_init__(self) -> None:
masks={"Grid Lost Fault": ["Grid Voltage Fault", "Grid Frequency Fault"]},
)

H3_PRO_FAULTS = FaultSet(
H3_PRO_KH_133_FAULTS = FaultSet(
faults=[
[
"PV Over-voltage",
Expand Down Expand Up @@ -215,7 +215,7 @@ def __post_init__(self) -> None:
None,
None,
"Meter Lost Fault",
None,
"BMS Lost Fault", # KH_133 only,
None,
None,
None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
pwr_limit_bat_up=None,
pv_voltages=[31000, 31003, 31039, 31042],
),
models=Inv.KH_119,
models=Inv.KH_PRE133 | Inv.KH_133,
),
RemoteControlAddressSpec(
# The H3 doesn't support anything above 44005, and the active/reactive power regisers are 2 values
Expand Down
4 changes: 2 additions & 2 deletions custom_components/foxess_modbus/inverter_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def __init__(
)
# See https://github.com/nathanmarlor/foxess_modbus/pull/512
KH_REGISTERS = SpecialRegisterConfig(
invalid_register_ranges=[(41001, 41006), (41012, 41012), (41019, 43999)],
invalid_register_ranges=[(41001, 41006), (41012, 41012), (41019, 43999), (31045, 31999)],
individual_read_register_ranges=[(41000, 41999)],
)
# See https://github.com/nathanmarlor/foxess_modbus/discussions/553
Expand Down Expand Up @@ -308,7 +308,7 @@ def inverter_capacity(self, inverter_model: str) -> int:
InverterModelProfile(InverterModel.KH, r"^KH([\d\.]+)").add_connection_type(
ConnectionType.AUX,
RegisterType.HOLDING,
versions={Version(1, 19): Inv.KH_PRE119, None: Inv.KH_119},
versions={Version(1, 19): Inv.KH_PRE119, Version(1, 33): Inv.KH_PRE133, None: Inv.KH_133},
special_registers=KH_REGISTERS,
),
# The H3 seems to use holding registers for everything
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@
null,
null,
"Meter Lost Fault",
null,
"BMS Lost Fault",
null,
null,
null,
Expand Down
Loading

0 comments on commit 094fcfe

Please sign in to comment.