Skip to content

Predbat sets battery charge power to inverter max value, despite calculating correct rate for low power mode #5182

Closed as not planned

Description

@cjt105

Describe the bug
Predbat sets battery charge power to inverter max value, despite calculating correct rate for low power mode.

Log shows that lowest power mode is calculated (in this case 600w), but despite this it immediately sets the charge power to the inverter max (2500w). Short excerpt from log file:

2026-09-20 23:00:07.592925: Inverter 0 Charge window will be: 2026-09-20 23:00:00+01:00 - 2026-09-20 23:59:00+01:00 - current SoC 36%, target 100% 2026-09-20 23:00:07.593299: Find charge rate for low power mode: SoC: 1.976kW, target_SoC: 5.49kW, charge_left: 3.51kW, minutes_left: 410, abs_minutes_left: 420, max_rate: 2500W, min_rate: 501W, min_rate_w: 501W 2026-09-20 23:00:07.597425: Low Power mode: minutes left: 410, absolute: 420, SoC: 1.976kW, Target SoC: 5.49kW, Charge left: 3.51kW, Max rate: 2500W, Min rate: 501W, Best rate: 600W, Best rate real: 600W, Battery temp 20°C 2026-09-20 23:00:07.597540: Inverter 0 Target SoC 100%, (this inverter 100%), battery temperature 20°C, select charge rate 600W (real 600W), current charge rate 2500W 2026-09-20 23:00:07.597790: Inverter 0 Adjust idle time, charge 23:00:00-23:59:00 discharge 00:00:00-00:00:00 2026-09-20 23:00:07.598151: Inverter 0 Adjust demand (idle) time computed is 00:00:00-00:00:00 2026-09-20 23:00:07.598315: Inverter 0 set new demand (idle) start time to 00:00:00 was 20:40:00 2026-09-20 23:00:07.628586: Inverter 0 write_and_poll_value: Wrote 00:00:00 to idle_start_time, successfully now 00:00:00 2026-09-20 23:00:07.628807: Inverter 0 set new demand (idle) end time to 00:00:00 was 23:00:00 2026-09-20 23:00:07.655756: Inverter 0 write_and_poll_value: Wrote 00:00:00 to idle_end_time, successfully now 00:00:00 2026-09-20 23:00:07.656066: Inverter 0 setting charging SoC to 100% as per target 2026-09-20 23:00:07.656176: Inverter 0 adjust target SoC for charge to 100% based on requested all inverter SoC 100% 2026-09-20 23:00:07.656338: Inverter 0 Current charge limit is 5% and new target is 100% 2026-09-20 23:00:07.685841: Inverter 0 write_and_poll_value: Wrote 100 to charge_limit, successfully now 100.0 2026-09-20 23:00:07.686200: Inverter 0 Current SoC 36% is less than Target SoC 100. Grid charging enabled with charge current set to 65.00 2026-09-20 23:00:07.686529: Inverter 0 Calling service charge_stop_service domain discharge service_name select/select_option with data {'entity_id': 'select.anker_solix_solarbank_4_e5000_pro_848_operating_mode_device_runs_by_command_in_third_party_controlled', 'option': 'self_consumption'} 2026-09-20 23:00:07.806897: Inverter 0 Calling service charge_start_service domain charge service_name select/select_option with data {'entity_id': 'select.anker_solix_solarbank_4_e5000_pro_848_operating_mode_device_runs_by_command_in_third_party_controlled', 'option': 'third_party_control'} 2026-09-20 23:00:07.935399: Inverter 0 Calling service charge_start_service domain charge service_name select/select_option with data {'entity_id': 'select.anker_solix_solarbank_4_e5000_pro_848_grid_flow', 'option': 'charge'} 2026-09-20 23:00:08.041796: Inverter 0 Calling service charge_start_service domain charge service_name number/set_value with data {'entity_id': 'number.anker_solix_solarbank_4_e5000_pro_848_power_control', 'value': '2500'} 2026-09-20 23:00:08.149039: Inverter 0 current charge rate is 2500W and new target is 600W 2026-09-20 23:00:08.149308: Inverter 0 count register writes 0 2026-09-20 23:00:08.273117: Will not recompute the plan, it is 5.0 minutes old and max age is 10 minutes 2026-09-20 23:00:08.313663: Total inverter register writes now 0 2026-09-20 23:00:08.558418: Car 0 charging Manual SoC current is 0.0 next is 0.0 2026-09-20 23:00:08.602955: Info: Completed run status Charging 2026-09-20 23:00:08.969422: Info: record_status Charging target 36%-100.0% 2026-09-20 23:00:09.012526: Saved current settings to /app_configs/6adb4f0d_predbat/predbat_config.json

Expected behaviour

Predbat has switch.predbat_set_charge_low_power = true

I therefore expect it to calculate the lowest possible charging rate across the charging session, and then use that value when enabling charging.

Predbat version

v9.1.0

Environment details

  • Inverter and battery setup

Anker Solarbank 4 E5000 pro

  • Standard HAOS installer

Screenshots
If applicable, add screenshots to help explain your problem. The most useful ones can be your battery chart, the Predbat HTML plan and your current settings in HA.

Log file

predbat.log

Predbat debug yaml file

apps.yaml

Activity

  1. springfall2008 commented on Sep 21, 2026

    @springfall2008
    Owner

    Automated first-pass triage — a maintainer will review before any action is taken.

    Classification: bug — and a high-confidence duplicate of #3311 ("Low power mode does not work on Solax"): same root cause, different integration (Anker Solarbank 4 via the Service API here, Solax script there). Closing as duplicate so the fix work stays in one place; please continue any discussion on #3311.

    Priority: priority_medium — this affects every script/service-driven inverter configured with output_charge_control: "power" and a {power} placeholder in charge_start_service (Solax, Anker Solix, Hanchu-style setups). A workaround exists (below).

    What I verified against current main (8b9fe02, v9.0.3-177-g8b9fe029) using your attached log and apps.yaml:

    1. Low power mode computes correctly — your log shows Best rate: 600W at 23:00:07.
    2. The charge_start_service template's {power} is filled in adjust_charge_immediate() (apps/predbat/inverter.py:3081-3086), which passes power: int(self.get_current_charge_rate()) — the currently read rate, not the newly computed one.
    3. get_current_charge_rate() (apps/predbat/inverter.py:1959) reads the charge_rate/charge_rate_percent entity, and otherwise falls back to battery_rate_max_raw. The dummy rate entities that would provide a place to store the computed rate are auto-created only when output_charge_control is not "power" (apps/predbat/inverter.py:630-636), so a purely service-driven "power" inverter has no charge_rate entity and the fallback is always the inverter max — 2500W. That is exactly the 'value': '2500' your log shows being written to number.anker_solix_..._power_control right after "select charge rate 600W".
    4. The computed 600W is applied by the rate-apply pass after the per-inverter loop (apps/predbat/execute.py:982 → apply_inverter_rates), and here that write is a no-op too because there is no charge_rate/charge_rate_percent entity to write to — hence count register writes 0.

    This is precisely the diagnosis already recorded on #3311 (same failure there: {'power': '8000'} instead of the best rate on Solax). The fix proposed on that issue — PR #4645, auto-creating the charge_rate/discharge_rate entities for script-driven "power" inverters — is still open and unmerged, which is why v9.1.0 still behaves this way. Note #3311 currently carries a "fixed" label, but no fix has landed on main yet.

    Workaround (from the #3311 thread, confirmed working there by two users): create two HA helper number entities (units W) and point Predbat at them:

      charge_rate: input_number.predbat_charge_rate
      discharge_rate: input_number.predbat_discharge_rate

    Predbat then writes the computed rate into those entities and {power} picks it up. One caveat I confirmed in the code: the charge_start_service call happens in the per-inverter loop before the rate-apply pass, so {power} trails a rate change by one 5-minute cycle; with the default call-once-until-changed dedup it self-corrects on the next run.

    Side note: has_service_api: true in your apps.yaml is not a recognised Predbat setting (it matches nothing in the codebase) — harmless, but inert; the service path is driven purely by defining charge_start_service/charge_stop_service.

    All four bug-report items (version, environment, log, apps.yaml) are present — nothing further needed from you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BOT_TRIAGEDHas been through the triage botbugSomething isn't workingduplicateThis issue or pull request already existspriority_medium

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions