Skip to content

Inverter tab 'Charge Power Rate' shows stale 40% default instead of live sensor value #271

Description

@johanzander

Description

Reported by beta users (Markus Eriksson, and confirmed by another user "Niklas"): the Inverter tab always shows Charge Power Rate as 40%, regardless of the actual value reported by the underlying HA sensor (e.g. 100%). Reproducible across versions — not a new regression.

Root cause

The field is not wired to a live sensor read at all — it renders a static config default.

  • frontend/src/components/InverterStatusDashboard.tsx:699-703 renders:

    { label: "Charge Power Rate", value: batterySettings?.chargingPowerRate || 0, unit: "%", ... }

    batterySettings comes from /api/settings — the configured value, not a live read.

  • Compare to "Discharge Power Rate" right below it (line 704-713), which correctly uses inverterStatus?.dischargePowerRate, populated in backend/api.py:1430 via controller.get_discharging_power_rate() — a genuine live HA sensor read.

  • /api/inverter/status (backend/api.py:1391-1456) never calls the equivalent controller.get_charging_power_rate() (which exists and works, ha_api_controller.py:1124-1126) — there's no live charge-rate field in that response at all. Discharge rate is live; charge rate is not.

  • 40% is exactly BATTERY_DEFAULT_CHARGING_POWER_RATE in core/bess/settings.py:44, used as the default in BatterySettings.charging_power_rate (core/bess/settings.py:125) and re-asserted at startup (backend/settings_store.py:475).

  • The optimizer does update an in-memory target_charging_power_pct every period (battery_system_manager.py:2895-2919), but this is never persisted back into battery_settings.charging_power_rate. So /api/settings (and the Inverter tab) always reports the original default unless a user manually edits it in Settings.

Not a register-scaling bug: get_charging_power_rate()/set_charging_power_rate() (ha_api_controller.py:1124-1137) apply no incorrect factor — they're just never invoked by the endpoint feeding this UI field.

Fix

Wire /api/inverter/status to also call controller.get_charging_power_rate() (mirroring the existing discharge-rate live read) and have the Inverter tab display that live value instead of batterySettings.chargingPowerRate.

Evidence

  • frontend/src/components/InverterStatusDashboard.tsx:699-703
  • backend/api.py:1391-1456 (missing live charge_power_rate field)
  • core/bess/settings.py:44,125
  • backend/settings_store.py:475
  • core/bess/ha_api_controller.py:1124-1137

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions