Skip to content

Commit

Permalink
Merge pull request #766 from canton7/bugfix/kh-tweaks
Browse files Browse the repository at this point in the history
Various fixes from #762
  • Loading branch information
canton7 authored Feb 3, 2025
2 parents 6e9fbe8 + c15ca1a commit 91cdc65
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"[python]": {
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
}
},
"editor.defaultFormatter": "charliermarsh.ruff"
},
"python.analysis.extraPaths": [
"./custom_components/foxess_modbus/vendor/pymodbus/pymodbus-3.6.9"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ def _master_version(address: list[ModbusAddressSpec], is_hex: bool) -> ModbusVer
yield _master_version(
address=[
ModbusAddressSpec(holding=30016, models=Inv.KH_PRE133),
ModbusAddressSpec(holding=36001, models=Inv.KH_133),
ModbusAddressSpec(holding=36001, models=Inv.H1_G2_SET),
ModbusAddressSpec(holding=36001, models=Inv.H1_G2_SET | Inv.KH_133),
],
is_hex=True,
)
Expand All @@ -89,7 +88,7 @@ def _slave_version(address: list[ModbusAddressSpec], is_hex: bool) -> ModbusVers
address=[
ModbusAddressSpec(input=10017, models=Inv.H1_G1 | Inv.KH_PRE119),
ModbusAddressSpec(holding=30017, models=Inv.H1_G1 | Inv.H1_LAN | Inv.H3_SET),
ModbusAddressSpec(holding=36001, models=Inv.H3_PRO),
ModbusAddressSpec(holding=36002, models=Inv.H3_PRO),
],
is_hex=False,
)
Expand Down
2 changes: 1 addition & 1 deletion 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), (31045, 31999)],
invalid_register_ranges=[(41001, 41006), (41012, 41012), (41019, 43999), (31055, 31999)],
individual_read_register_ranges=[(41000, 41999)],
)
# See https://github.com/nathanmarlor/foxess_modbus/discussions/553
Expand Down
2 changes: 1 addition & 1 deletion custom_components/foxess_modbus/modbus_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ async def autodetect(client: ModbusClient, slave: int, adapter_config: dict[str,
_LOGGER.error("Did not recognise inverter model '%s' (%s)", full_model, register_values)
raise UnsupportedInverterError(full_model)
except Exception as ex:
_LOGGER.exceptino("Autodetect: failed to connect to (%s)", client)
_LOGGER.exception("Autodetect: failed to connect to (%s)", client)
raise AutoconnectFailedError(spy_handler.records) from ex
finally:
pymodbus_logger.removeHandler(spy_handler)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1664,7 +1664,7 @@
{
"addresses": {
"holding": [
36001
36002
]
},
"is_hex": false,
Expand Down

0 comments on commit 91cdc65

Please sign in to comment.