diff --git a/.vscode/settings.json b/.vscode/settings.json index 59db7c07..654bd74a 100755 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -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" diff --git a/custom_components/foxess_modbus/entities/entity_descriptions.py b/custom_components/foxess_modbus/entities/entity_descriptions.py index ae200293..6e109e80 100644 --- a/custom_components/foxess_modbus/entities/entity_descriptions.py +++ b/custom_components/foxess_modbus/entities/entity_descriptions.py @@ -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, ) @@ -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, ) diff --git a/custom_components/foxess_modbus/inverter_profiles.py b/custom_components/foxess_modbus/inverter_profiles.py index ae9e0558..da597516 100644 --- a/custom_components/foxess_modbus/inverter_profiles.py +++ b/custom_components/foxess_modbus/inverter_profiles.py @@ -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 diff --git a/custom_components/foxess_modbus/modbus_controller.py b/custom_components/foxess_modbus/modbus_controller.py index a984627c..06c6e945 100644 --- a/custom_components/foxess_modbus/modbus_controller.py +++ b/custom_components/foxess_modbus/modbus_controller.py @@ -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) diff --git a/tests/__snapshots__/test_entity_descriptions/test_entity_descriptions_for_model[Inv.H3_PRO].json b/tests/__snapshots__/test_entity_descriptions/test_entity_descriptions_for_model[Inv.H3_PRO].json index f91a9653..8baec652 100644 --- a/tests/__snapshots__/test_entity_descriptions/test_entity_descriptions_for_model[Inv.H3_PRO].json +++ b/tests/__snapshots__/test_entity_descriptions/test_entity_descriptions_for_model[Inv.H3_PRO].json @@ -1664,7 +1664,7 @@ { "addresses": { "holding": [ - 36001 + 36002 ] }, "is_hex": false,