Battery rate grid learning fails on SolaX SX4 Mode 8 service-controlled inverters
Environment
- Predbat v9.10.6
- Home Assistant OS
- SolaX X1-Hybrid-G4 inverter
- SolaX TP 5.8 V3 battery
- SolaX Modbus integration
- Remote Control Mode 8
- Single inverter
- Configured battery rate: 3750 W
- Configured battery capacity: 5.8 kWh
Description
Automatic battery charge and discharge rate grid learning does not collect any evidence on a SolaX inverter using Mode 8 script-based control.
Charts > Curves shows:
- Charge and discharge cells: 0
- Evidence days: 0
- Source: default
- Last scan: regularly updated
- Learned grid in use: No
Automatic grid learning is enabled and low-power charging is disabled.
Log messages
Warn: Inverter 0 Cannot find battery charge rate grid (settings missing), charge_rate not set in apps.yaml
Warn: Inverter 0 Cannot find battery discharge rate grid (settings missing), discharge_rate not set in apps.yaml
These warnings occur on every rate grid scan.
Battery temperature history is successfully retrieved and normal Predbat charging and discharging control is functioning.
Relevant configuration
inverter_type: SOLAX
battery_rate_max:
- 3750
soc_max:
- 5.8
charge_start_service:
- service: script.solax_remote_control_mode_8
power: '{power}'
operation: Force Charge
discharge_start_service:
- service: script.solax_remote_control_mode_8
power: '{power}'
operation: Force Discharge
Neither charge_rate nor discharge_rate is configured, consistent with the service-driven SolaX configuration.
Suspected root cause
In inverter.py, rate_without_entity() explicitly supports service-controlled inverters such as the SolaX SX4, where Predbat internally maintains the requested charge/discharge rate and passes it to the control script using {power}.
However, battery_curve.py requires configured charge_rate and discharge_rate entities for historical rate grid learning.
The scanner returns before processing historical evidence when these settings are absent.
Adding these settings to apps.yaml would also affect rate_without_entity() and potentially change normal inverter control behaviour.
Suggested resolution
Provide a separate historical rate source for service-controlled inverters, either by:
- Publishing dedicated historical requested charge/discharge power sensors from Predbat's internal rate state and automatically using these for rate grid learning; or
- Supporting optional charge_rate_history and discharge_rate_history entity mappings independently of writable inverter control entities.
The SolaX Mode 8 signed power command is already available through the Modbus integration and could be split into separate positive charge and discharge historical template sensors.
Expected behaviour
Automatic battery rate grid learning should operate on service-controlled inverters without requiring the addition of writable charge_rate or discharge_rate entities, and without changing existing inverter control behaviour.
This is an automated first-pass triage from the Predbat bot; a maintainer will review it before any action is taken.
Classified as an enhancement (feature request, so no priority is set).
Confirmed against current main (v9.10.6): the rate grid learner needs a rate entity, and a service-controlled inverter has none.
BatteryCurve.load_curve_history()(apps/predbat/battery_curve.py:83) readscharge_rate/discharge_rate(battery_curve.py:115) and, frombattery_curve.py:175, returnsNonebefore touching any history when either is unset — that is the exactWarn: ... (settings missing), charge_rate not set in apps.yamlline you are seeing (battery_curve.py:179). Nothing else in the learner falls back to another source of the requested rate.- Your setup is the "power" shape:
output_charge_control: powerwith{power}in the start/freeze services, soInverter.rate_without_entity()(apps/predbat/inverter.py:2091) isTrueand Predbat keeps the rate it asked for in memory (rate_last_set) rather than in an entity. Yourpredbat_debug.yamlconfirms it:inverter_rate_intent → 0 → charge_rate: 3750,battery_rate_grid_learnedempty,battery_rate_grid_source: charge: default. - So your reading of the cause is right, and so is the side effect you flagged: setting
charge_rateflipsrate_without_entity()toFalse, after which Predbat writes the planned rate to that entity and takes the{power}it sends your script back from it (get_current_charge_rate()→rate_or_last_set()), instead of holding it itself. That is not theoretical — #6435 is a report from exactly that change on a SolaX Gen4, where charging then failed and the entities were commented back out.
Related: #6435 (same gap, asked as a question and closed with the advice to leave the settings unset). The warning itself is documented — the FAQ entry "Warn: Cannot find battery charge rate grid" and the SolaX section of the inverter setup guide both tell script-controlled users to either point these at real inverter sensors or enter battery_charge_power_curve / battery_discharge_power_curve by hand.
There is no configuration workaround I can find that both feeds the learner and leaves control alone: any charge_rate/charge_rate_percent entry for the inverter makes Predbat write to it, and nothing in apps.yaml marks an entity read-only. Until this is built, the supported route is the manual curves.
Both suggestions in the issue would fit the current design: a dedicated history-only mapping (so the writable controls stay untouched) is the smaller change, since load_curve_history() could read it where it reads rate_name today; publishing the requested rate as a Predbat sensor would also work but only from the point it starts recording, so the first grid would take days to accumulate. For the discharge grid note that grid_power history is also required when export_limit is set — yours is not, and grid_power is configured, so that side would gather evidence as soon as a rate history exists.
Nothing else is needed from you; the maintainer will decide whether to take this on.
Adding an internal sensors for storing charge/discharge power would be the optimal solution here from a feature standpoint. Minimal change that can basically follow the same way that predbat already creates internal sensors for some inverters.
My suggestion at the end of the linked issue will work fine as a workaround for now - creating a pair of fake template sensors for storing the commanded charge rate (and another pair for discharge rate). This still allows the service API to work correctly because the values stored in the template sensors are valid and passed into the service API. I have used this approach successfully for over a year.