Description
Reported by a beta user (Markus Eriksson): the setup wizard's auto-discovery for SolaX/Growatt GEN4 modbus selects the off-grid "EMS Discharging Stop SOC" sensor instead of the on-grid one, requiring manual correction after the wizard runs.
Root cause
The upstream solax_modbus integration (wills106/homeassistant-solax-modbus, Growatt plugin) exposes two separate registers:
ems_discharging_stop_soc — off-grid, register 3037
ems_discharging_stop_soc_on_grid — on-grid, register 3067 (newer firmware)
Our discovery suffix map SOLAX_GROWATT_MIN_SUFFIX_MAP in core/bess/ha_api_controller.py:548 only contains an entry for the off-grid key:
"ems_discharging_stop_soc": "battery_discharge_stop_soc",
There is no entry for ems_discharging_stop_soc_on_grid. Matching is done via unique_id.endswith(f"_{suffix}") (ha_api_controller.py:2892), which is intentionally suffix-based rather than full-unique_id-based because the SolaX device name prefix is user-configurable — the register key is the only invariant part of the unique_id. Since the on-grid suffix isn't in the map at all, the on-grid sensor can never be matched; the wizard always resolves to the off-grid one.
Fix
Add "ems_discharging_stop_soc_on_grid": "battery_discharge_stop_soc" to SOLAX_GROWATT_MIN_SUFFIX_MAP, and remove or otherwise deprioritize the off-grid mapping so it isn't silently chosen on on-grid installs (needs a decision on how to prefer on-grid vs off-grid when both entities exist — likely prefer on-grid if present, fall back to off-grid otherwise).
Evidence
core/bess/ha_api_controller.py:548 (missing suffix map entry)
core/bess/ha_api_controller.py:2892 (suffix matching logic)
- Design-doc comment at
core/bess/ha_api_controller.py:346 documents the intended target as solax_ems_discharging_stop_soc, confirming the on-grid variant was an original oversight, not a matcher bug.
Description
Reported by a beta user (Markus Eriksson): the setup wizard's auto-discovery for SolaX/Growatt GEN4 modbus selects the off-grid "EMS Discharging Stop SOC" sensor instead of the on-grid one, requiring manual correction after the wizard runs.
Root cause
The upstream
solax_modbusintegration (wills106/homeassistant-solax-modbus, Growatt plugin) exposes two separate registers:ems_discharging_stop_soc— off-grid, register 3037ems_discharging_stop_soc_on_grid— on-grid, register 3067 (newer firmware)Our discovery suffix map
SOLAX_GROWATT_MIN_SUFFIX_MAPincore/bess/ha_api_controller.py:548only contains an entry for the off-grid key:There is no entry for
ems_discharging_stop_soc_on_grid. Matching is done viaunique_id.endswith(f"_{suffix}")(ha_api_controller.py:2892), which is intentionally suffix-based rather than full-unique_id-based because the SolaX device name prefix is user-configurable — the register key is the only invariant part of the unique_id. Since the on-grid suffix isn't in the map at all, the on-grid sensor can never be matched; the wizard always resolves to the off-grid one.Fix
Add
"ems_discharging_stop_soc_on_grid": "battery_discharge_stop_soc"toSOLAX_GROWATT_MIN_SUFFIX_MAP, and remove or otherwise deprioritize the off-grid mapping so it isn't silently chosen on on-grid installs (needs a decision on how to prefer on-grid vs off-grid when both entities exist — likely prefer on-grid if present, fall back to off-grid otherwise).Evidence
core/bess/ha_api_controller.py:548(missing suffix map entry)core/bess/ha_api_controller.py:2892(suffix matching logic)core/bess/ha_api_controller.py:346documents the intended target assolax_ems_discharging_stop_soc, confirming the on-grid variant was an original oversight, not a matcher bug.