Skip to content

feat: add external_solar_mode for AC-coupled PV setups - #1

Merged
jdungen merged 1 commit into
mainfrom
claude/ac-coupled-pv-solar-mode-o767wv
Jul 14, 2026
Merged

feat: add external_solar_mode for AC-coupled PV setups#1
jdungen merged 1 commit into
mainfrom
claude/ac-coupled-pv-solar-mode-o767wv

Conversation

@jdungen

@jdungen jdungen commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Port of johanzander/bess-manager#167 (external_solar_mode for AC-coupled PV setups).

Why

When solar panels are wired to a separate inverter (AC-coupled PV), the battery inverter has no DC solar input. During SOLAR_STORAGE periods the battery sat idle: Load First mode never triggers charging and grid_charge was disabled.

What

New opt-in battery setting external_solar_mode (default off, so DC-coupled behavior is unchanged). When enabled, SOLAR_STORAGE periods switch to Battery First mode with grid_charge=True, so the battery AC-charges from surplus solar returning through the meter. All other intents keep their default mapping. Toggle is exposed in Settings → Battery and in the setup wizard ("External solar mode (AC-coupled PV)").

Adaptations relative to upstream #167

  • api.py live-updates use snake_case store field names (this repo's #197/#219 convention)
  • kept this repo's _scale_to_percent/_compute_charge_rate refactor in inverter_controller.py, applied the override on top
  • tests use BATTERY_EXPORT (this repo's name for upstream's EXPORT_ARBITRAGE)
  • external_solar_mode added to _BATTERY_OPTIONAL_FIELDS in the settings contract test (class default False, not required at startup)

Verification

  • 1170 fast backend tests pass locally, including 17 new tests in core/bess/tests/unit/test_external_solar_mode.py
  • black + ruff clean
  • frontend npm run build and npm run lint clean (0 errors)

🤖 Generated with Claude Code

https://claude.ai/code/session_01JD7RhRSGxkW8zZirZQFRFC


Generated by Claude Code

Port of johanzander/bess-manager#167. When solar panels are wired to a
separate inverter (AC-coupled PV), the battery inverter has no DC solar
input, so SOLAR_STORAGE periods left the battery idle: Load First mode
never triggers charging and grid_charge was disabled.

With the new opt-in battery setting external_solar_mode enabled,
SOLAR_STORAGE periods switch to Battery First mode with grid_charge=True
so the battery AC-charges from surplus solar returning through the meter.
All other intents keep their default mapping.

Adaptations to this repo relative to upstream:
- api.py live_updates uses snake_case store field names (issue #197/#219)
- kept the _scale_to_percent/_compute_charge_rate refactor in
  inverter_controller.py and applied the override on top of it
- tests use BATTERY_EXPORT (this repo's name for upstream's
  EXPORT_ARBITRAGE)
- external_solar_mode added to _BATTERY_OPTIONAL_FIELDS in the settings
  contract test (class default False, not required at startup)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JD7RhRSGxkW8zZirZQFRFC
@jdungen
jdungen merged commit c5707fa into main Jul 14, 2026
jdungen added a commit that referenced this pull request Jul 14, 2026
The external_solar_mode override (#1) covered the base-class rate/mode
mapping and the solax_modbus controller, but not the two paths that
build the TOU segments actually written to Growatt hardware:

- GrowattMinController._group_periods_by_mode() read INTENT_TO_MODE
  directly, so SOLAR_STORAGE stayed load_first. Load-first groups are
  skipped when converting to TOU intervals, so no battery-first segment
  was ever programmed and an AC-coupled battery sat idle through the
  whole solar window.
- GrowattSphController excludes SOLAR_STORAGE from CHARGE_INTENTS on
  the assumption that an SPH charges from its own MPPT. With no DC
  solar input that never happens; SOLAR_STORAGE must produce an AC
  charge period.

Both paths now honor the override: MIN grouping goes through
_effective_mode_for_intent, and SPH uses _effective_charge_intents()
which adds SOLAR_STORAGE when external_solar_mode is enabled.


Claude-Session: https://claude.ai/code/session_01JD7RhRSGxkW8zZirZQFRFC

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants