Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds additional BMS entities for H1 G2 and KH inverters on latest firmware #735

Merged
merged 8 commits into from
Jan 26, 2025
6 changes: 4 additions & 2 deletions custom_components/foxess_modbus/common/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ class Inv(Flag):

H1_LAN = auto()
H1_G1 = auto()
H1_G2 = auto()
H1_G2_PRE144 = auto()
H1_G2_144 = auto()
H1_G2_SET = H1_G2_PRE144 | H1_G2_144

KH_PRE119 = auto()
KH_PRE133 = auto()
Expand All @@ -78,7 +80,7 @@ class Inv(Flag):

H3_PRO = auto()

ALL = H1_LAN | H1_G1 | H1_G2 | KH_SET | H3_SET | H3_PRO
ALL = H1_LAN | H1_G1 | H1_G2_SET | KH_SET | H3_SET | H3_PRO


class RegisterPollType(IntEnum):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
period_end_address=41003,
enable_charge_from_grid_address=41001,
),
models=Inv.H1_G2,
models=Inv.H1_G2_SET,
),
],
period_start_key="time_period_1_start",
Expand Down Expand Up @@ -54,7 +54,7 @@
period_end_address=41006,
enable_charge_from_grid_address=41004,
),
models=Inv.H1_G2,
models=Inv.H1_G2_SET,
),
],
period_start_key="time_period_2_start",
Expand Down
138 changes: 77 additions & 61 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 @@ -56,7 +56,7 @@
pwr_limit_bat_up=None,
pv_voltages=[39070, 39072],
),
models=Inv.H1_G2,
models=Inv.H1_G2_SET,
),
# The KH doesn't support anything above 44003
RemoteControlAddressSpec(
Expand Down
6 changes: 3 additions & 3 deletions custom_components/foxess_modbus/inverter_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def parse(version: str) -> "Version":
raise ValueError(f"Version {version} is not a valid version")
return Version(int(match[1]), int(match[2]))

def __eq__(self, other: Any) -> bool:
def __eq__(self, other: object) -> bool:
return isinstance(other, Version) and self.major == other.major and self.minor == other.minor

def __hash__(self) -> int:
Expand Down Expand Up @@ -246,7 +246,7 @@ def inverter_capacity(self, inverter_model: str) -> int:
).add_connection_type(
ConnectionType.AUX,
RegisterType.HOLDING,
versions={None: Inv.H1_G2},
versions={Version(1, 44): Inv.H1_G2_PRE144, None: Inv.H1_G2_144},
special_registers=H1_G2_REGISTERS,
),
# Can be both e.g. H1-5.0 and H1-5.0-E, but not H1-5.0-E-G2
Expand All @@ -268,7 +268,7 @@ def inverter_capacity(self, inverter_model: str) -> int:
).add_connection_type(
ConnectionType.AUX,
RegisterType.HOLDING,
versions={None: Inv.H1_G2},
versions={Version(1, 44): Inv.H1_G2_PRE144, None: Inv.H1_G2_144},
special_registers=H1_G2_REGISTERS,
),
InverterModelProfile(InverterModel.AC1, r"^AC1-([\d\.]+)", capacity_parser=CapacityParser.H1)
Expand Down
Loading
Loading