Skip to content

Feature Request "Mindest-SoC: Automatik-Option für Phasenwahl ergänzen" - #4068

Merged
LKuemmel merged 7 commits into
openWB:masterfrom
seaspotter:min-soc-automatic-phases
Nov 4, 2026
Merged

LKuemmel merged 7 commits into
openWB:masterfrom
seaspotter:min-soc-automatic-phases

Conversation

@seaspotter

@seaspotter seaspotter commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Feature Request: #4005
UI: openWB/openwb-ui-settings#1119

Was

Ergänzt die bisher nicht vorhandene "Automatik"-Option für die Phasenwahl beim Mindest-SoC (phases_to_use_min_soc), analog zur bereits vorhandenen Automatik bei PV-Ladeziel und Eco-Laden.

Hintergrund: siehe #3989 und #4005 - bisher musste man sich bei aktivem Mindest-SoC fest für 1 oder 3 Phasen entscheiden. Mit Automatik bleibt der konfigurierte Mindest-SoC-Ladestrom als feste Untergrenze bestehen, Phasen werden aber automatisch hoch- bzw. runtergeschaltet, wenn mehr bzw. weniger Überschuss verfügbar ist - der Strom selbst wird dabei nicht unter den Mindest-SoC-Ladestrom reduziert.

Umsetzung

Die bereits bestehende automatische Phasenumschaltung (_check_auto_phase_switch_delay() / auto_phase_switch()) wird unverändert wiederverwendet - sie läuft für jeden Ladepunkt mit template_phases == 0, unabhängig vom Lademodus. Sie nutzt control_parameter.min_current bereits als Untergrenze für beide Phasenzahlen. Einzige Änderung: min_current wird während aktiver Mindest-SoC-Ladung auf min_soc_current/dc_min_soc_current gesetzt statt auf den allgemeinen Mindeststrom des Fahrzeugs. Keine neue Umschaltlogik.

Zusätzlich gefunden und mitbehoben: min_current darf sich nicht ändern, während eine automatische Phasenumschaltung bereits läuft (Umschaltverzögerung), da auto_phase_switch() die zu reservierende/freizugebende Leistung bei jedem Aufruf frisch daraus berechnet - ein Wechsel mittendrin hätte reserved_surplus dauerhaft verfälscht. Das war vorher nie erreichbar, weil min_current während einer Session nie geändert wurde - erst durch diese Änderung wird genau dieser Fall möglich.

Test

Unit-Tests für beide Fälle. Zusätzlich live mit einem Testsystem und dem Simulator über MQTT durchgespielt: Laden unterhalb Mindest-SoC mit wenig Überschuss (1 Phase, Strom bleibt am Mindest-SoC-Strom), mit viel Überschuss (automatische Umschaltung auf 3 Phasen), Rückschaltung bei sinkendem Überschuss, sowie der kritische Fall - Mindest-SoC wird exakt während einer laufenden Umschaltung erreicht - sauber ohne Fehler oder hängenbleibende Reservierung.

Frontend

@Brett-S-OWB @cshagen könnt ihr bitte kurz über die Koala- bzw. Colors-Integration schauen? Hab das alles mit in den PR hier mit rein. Jeweils im Colors und Koala/Display Theme den Automatik Button ergänzt. Hab ich aber nicht live getestet, nur im UI Repo hab ich ein Built gemacht.
Alternativ kann ich es auch aus dem PR loslösen, wenn ihr das selbst mitmachen wollt?

Summary by Sourcery

Enable automatic phase selection during minimum-SoC charging while preserving the configured minimum charging current and reservation state.

New Features:

  • Add an automatic phase-selection option for minimum-SoC charging across supported vehicle configuration themes.

Bug Fixes:

  • Prevent reserved surplus from becoming inconsistent when phase-switching parameters change during a delayed automatic phase switch.

Enhancements:

  • Use the configured minimum-SoC charging current as the lower bound for automatic phase switching.

Tests:

  • Add coverage for minimum-current-based phase-switch conditions and accurate cleanup of reserved switching power.

…hasenwahl

auto_phase_switch() nutzt control_parameter.min_current bereits als Untergrenze
für die automatische 1p/3p-Umschaltung - dieser wird jetzt während aktiver
Mindest-SoC-Ladung auf min_soc_current/dc_min_soc_current gesetzt statt auf
den allgemeinen Mindeststrom des Fahrzeugs. Keine neue Umschaltlogik nötig,
die bestehende automatische Phasenumschaltung greift dafür unverändert, sobald
phases_to_use_min_soc == 0 zulässig ist (Frontend-Erweiterung).

min_current bleibt zusätzlich während einer laufenden Phasenumschaltung
eingefroren, da auto_phase_switch() die reservierte Leistung sonst mit
unterschiedlichen Werten reserviert und wieder freigibt.
…gänzen

phases_to_use_min_soc == 0 (Automatik) wird vom Backend bereits unterstützt,
in cards/colors/koala/standard_legacy fehlte dafür nur der dritte Button -
analog zur bereits vorhandenen Automatik-Option bei PV-Ladeziel/Eco-Laden.
display_themes/colors hat aktuell gar keine Phasenauswahl für Mindest-SoC
und bleibt daher unverändert.

@cshagen cshagen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Die Änderungen am Colors-Theme sind gut!

soc = self.data.set.charging_ev_data.data.get.soc
if (self.data.control_parameter.chargemode == Chargemode.PV_CHARGING and
pv_charging.min_soc != 0 and soc is not None and soc < pv_charging.min_soc):
self.data.control_parameter.min_current = (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Das hat zur Folge, dass beim Runterregeln durch das Lastmanagement nicht mehr mit weniger als min-soc-current geladen wird und dann direkt abgeschaltet wird, auch wenn das Auto mit weniger Strom laden könnte.
Klare Lösung wäre, eine neue Variable control_parameter.reserved_power einzuführen. Dann können da auch keine Race Conditions mehr entstehen.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reserved_power habe ich wie vorgeschlagen ergänzt. Zusätzlich hab ich min_current von der Mindest-SoC-Logik getrennt (neu: min_soc_current), sonst wäre der eigentliche Bug (Lastmanagement schaltet komplett ab statt mit weniger zu laden) noch da gewesen - min_current bleibt jetzt unverändert der harte Lastmanagement-Untergrenze. Passt das so für dich?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reserved_power habe ich wie vorgeschlagen ergänzt.

Das passt so.

Zusätzlich hab ich min_current von der Mindest-SoC-Logik getrennt (neu: min_soc_current), sonst wäre der eigentliche Bug (Lastmanagement schaltet komplett ab statt mit weniger zu laden) noch da gewesen - min_current bleibt jetzt unverändert der harte Lastmanagement-Untergrenze. Passt das so für dich?

Die Variable brauchen wir meiner Meinung nach nicht. Die gleiche Situation gibt es aktuell schon bei beim PV-Laden mit Mindest-SoC. Aktuell ist es implementiert, dass hochgeschaltet wird, sobald einphasig mit Maximalstrom geladen wird.
Bei zB 14A Mindeststrom und Max 16A würde aktuell bei 16A hochgeschaltet werden und dann mit 4,2kW geladen. Bei deinem Vorschlag würde erst bei 9,6kW hochgeschaltet werden und der Überschuss zwischen 4,2 und 9,6kW ins Netz eingespeist werden. Der Gedanke hinter Automatik ist aber doch, möglichst so die Phasen zu schalten, dass möglichst viel Überschuss ins Auto geht.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sollte jetzt passen?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmh, ich dachte, dass Du die Änderungen in set_control_parameter komplett rausnimmst. So sind wir jetzt wieder bei dem Bug von oben "Lastmanagement schaltet komplett ab statt mit weniger zu laden". Und es wird auch erst hochgeschaltet, wenn der Min-SoC-Current auch für 3 Phasen erreicht ist und damit Überschuss eingespeist.
Also ich denke, dass die einzige Änderung am Python-Code das Speichern der reservierten Leistung ist statt diese immer neu zu berechnen.
für die Umschaltschwellen muss nichts geändert werden, dass wurde von Mindest-Strom im PV-Laden schon genutzt und sollte so passen.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, missverständnis auf meiner Seite, jetzt okay?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Der Merge-Status hängt, ich schließe und öffne den PR wieder.

@LKuemmel
LKuemmel requested a review from Brett-S-OWB October 30, 2026 14:57
@Brett-S-OWB

Copy link
Copy Markdown
Contributor

Koala-Teil getestet: Der "Automatik"-Button erscheint bei "Anzahl Phasen Mindest-SoC", wird korrekt hervorgehoben und setzt phases_to_use_min_soc im Ladeprofil auf 0. Von Koala-Seite passt das so 👍

@LKuemmel LKuemmel closed this Nov 4, 2026
@github-project-automation github-project-automation Bot moved this from Todo to Done in openWB Roadmap Nov 4, 2026
@LKuemmel LKuemmel reopened this Nov 4, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linked issues

#4005 Feature Request: "Mindest-Soc" so anpassen, dass kein PV-Überschuss eingespeist wird · 0 of 1 met

# Requirement Status Notes
1 Make minimum-SoC charging optionally treat its configured current as a lower bound and use available PV surplus in addition to it. 🟡 Partly met The new Automatik option enables phase switching during minimum-SoC charging, but the configured minimum-SoC current is not used as the lower bound for that switching or for additional surplus charging.

Comment thread packages/control/ev/ev.py
Comment on lines +324 to +325
required_reserved_power = max(0, control_parameter.min_current * max_phases * 230 -
self.ev_template.data.max_current_single_phase * 230)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High · Minimum current is not preserved

The change enables automatic phase selection, but it still bases switching power on control_parameter.min_current, which is the vehicle's general minimum current rather than the configured AC/DC minimum-SoC current. Consequently, minimum-SoC charging does not get the requested lower-bound behavior, and a phase switch can use a current below that configured minimum; there is also no choice between fixed-current and lower-bound behavior.

Prompt for AI agents
In `packages/control/ev/ev.py` at lines 324-325:

**Minimum current is not preserved**

The change enables automatic phase selection, but it still bases switching power on `control_parameter.min_current`, which is the vehicle's general minimum current rather than the configured AC/DC minimum-SoC current. Consequently, minimum-SoC charging does not get the requested lower-bound behavior, and a phase switch can use a current below that configured minimum; there is also no choice between fixed-current and lower-bound behavior.

From #4005:

Make minimum-SoC charging optionally treat its configured current as a lower bound and use available PV surplus in addition to it.

@sourcery-ai

sourcery-ai Bot commented Nov 4, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds an automatic phase-selection option for minimum-SoC charging by reusing the existing delayed phase-switch mechanism with the minimum-SoC current as its floor, while persisting the exact reserved switching power to prevent reservation drift when parameters change mid-switch. The option is added to all listed UI themes and covered by focused unit tests.

Sequence diagram for automatic minimum-SoC phase switching

sequenceDiagram
    participant Controller as ChargepointController
    participant EV as EV
    participant Counter as EVUCounter
    participant Control as ControlParameter

    Controller->>Control: set min_current to min_soc_current
    Controller->>EV: auto_phase_switch(control_parameter)
    EV->>Counter: get_usable_surplus()
    alt phase switch required
        EV->>Control: set reserved_power
        EV->>Counter: reserve reserved_power
        EV-->>Controller: PHASE_SWITCH_DELAY
    else delay completed
        EV->>Counter: release reserved_power
        EV->>Control: set phases_to_use and current
        EV-->>Controller: PHASE_SWITCH_AWAITED
    end
Loading

File-Level Changes

Change Details Files
Enable automatic phase selection for minimum-SoC charging across the supported configuration themes.
  • Expose phase option 0 as “Automatik” in the display, Colors, Koala, and legacy Standard themes.
  • Reuse the existing automatic phase-switching flow for minimum-SoC sessions, using the configured minimum-SoC current as the lower bound.
  • Preserve the existing manual 1-phase and maximum-phase options.
packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue
packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/ConfigPv.vue
packages/modules/web_themes/koala/source/src/components/ChargePointPvSettings.vue
packages/modules/web_themes/standard_legacy/web/index.html
packages/control/chargepoint/chargepoint.py
Make automatic phase-switch reservations stable when switching parameters change during the delay period.
  • Store the exact reserved switching power in the control parameters.
  • Use the stored reservation when recalculating surplus and when completing, cancelling, or resetting a delayed switch.
  • Remove the dependency on a freshly supplied maximum-phase value when resetting delayed switching.
  • Validate and expose the new reserved-power control parameter topic.
packages/control/chargepoint/control_parameter.py
packages/control/ev/ev.py
packages/helpermodules/setdata.py
packages/control/chargepoint/chargepoint.py
Add regression coverage for minimum-current-based switching and reservation cleanup.
  • Verify phase switching decisions use min_current as the required-current threshold.
  • Verify reset logic removes the exact previously reserved power and clears the stored reservation.
packages/control/ev/ev_test.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 7 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="packages/control/ev/ev.py" line_range="324-325" />
<code_context>
             direction_str = f"Umschaltung von 1 auf {max_phases}"
-            required_reserved_power = (control_parameter.min_current * max_phases * 230 -
-                                       self.ev_template.data.max_current_single_phase * 230)
+            required_reserved_power = max(0, control_parameter.min_current * max_phases * 230 -
+                                          self.ev_template.data.max_current_single_phase * 230)

             new_phase = max_phases
</code_context>
<issue_to_address>
**Minimum-SoC current floor is lost**

When minimum-SoC charging uses automatic phase selection and its configured current exceeds the vehicle’s general minimum, `set_control_parameter()` puts the vehicle’s general minimum in `min_current`, which `auto_phase_switch()` uses for the switch threshold and target current. The switch can therefore charge below the configured minimum-SoC current.

Use the configured minimum-SoC current for the automatic switch threshold and target during minimum-SoC charging.

Also at `packages/modules/web_themes/koala/source/src/components/ChargePointPvSettings.vue:120`, `packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue:1039`, `packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/ConfigPv.vue:82`, `packages/modules/web_themes/standard_legacy/web/index.html:959-960`.
</issue_to_address>

### Comment 2
<location path="packages/control/ev/ev.py" line_range="448" />
<code_context>
                         data.data.counter_all_data.get_evu_counter(
-                        ).data.set.reserved_surplus -= max(0, required_reserved_power)
+                        ).data.set.reserved_surplus -= control_parameter.reserved_power
+                        control_parameter.reserved_power = 0
                         phases_to_use = new_phase
                         current = new_current
</code_context>
<issue_to_address>
**Reserved surplus remains unavailable**

When a 1-to-3-phase delay has reserved power and the phase count changes from 1 before `reset_phase_switch_delay()` runs, `reset_phase_switch_delay()` releases and clears the reservation only when `control_parameter.phases == 1`, even though the charge-point update changes phases first. The reservation remains in `reserved_surplus`, reducing the surplus available to other charge points.

Release `reserved_power` and clear the delay reservation regardless of the current phase count.

Also at `packages/control/chargepoint/chargepoint.py:191`, `packages/control/chargepoint/chargepoint.py:667`, `packages/control/ev/ev.py:449`, `packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue:1039`, `packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/ConfigPv.vue:82`, `packages/modules/web_themes/koala/source/src/components/ChargePointPvSettings.vue:120`, `packages/modules/web_themes/standard_legacy/web/index.html:960`.
</issue_to_address>

### Comment 3
<location path="packages/control/chargepoint/chargepoint.py" line_range="667" />
<code_context>
                     if self.chargemode_changed or self.submode_changed:
                         data.data.counter_all_data.get_evu_counter().reset_switch_on_off(self)
-                        charging_ev.reset_phase_switch_delay(self.data.control_parameter, self.get_max_phase_hw())
+                        charging_ev.reset_phase_switch_delay(self.data.control_parameter)
                     if self.chargemode_changed:
                         self.data.control_parameter.failed_phase_switches = 0
</code_context>
<issue_to_address>
**Disabled automation strands phase delay**

When the automatic minimum-SoC phase option is changed to a fixed phase while an automatic phase-switch delay is active, `_check_auto_phase_switch_delay()` stops servicing the delay once `template_phases` is no longer 0, while `Chargepoint.update()` calls `reset_phase_switch_delay()` only when the chargemode or submode changes. Changing the minimum-SoC phase selection from automatic to a fixed option during a delay therefore leaves the charge point in `PHASE_SWITCH_DELAY` with its surplus reservation held; the requested phase switch never completes.

Cancel and release an active automatic phase-switch delay when the selected phase mode changes away from automatic.
</issue_to_address>

### Comment 4
<location path="packages/control/ev/ev.py" line_range="388-389" />
<code_context>
                     else:
                         data.data.counter_all_data.get_evu_counter(
-                        ).data.set.reserved_surplus -= max(0, required_reserved_power)
+                        ).data.set.reserved_surplus -= control_parameter.reserved_power
+                        control_parameter.reserved_power = 0
                         phases_to_use = new_phase
                         current = new_current
</code_context>
<issue_to_address>
**Restored reservations are not released**

When a restart or upgrade restores a pending phase-switch delay created before `reserved_power` existed, `reserved_power` defaults to zero, so the timeout and reset paths subtract zero instead of the existing reservation from `reserved_surplus`. Usable surplus remains understated after the delay ends or is cancelled.

Provide a compatibility fallback or migration that restores the prior reservation amount before the timeout and reset paths release it.

Also at `packages/control/ev/ev.py:447-449`, `packages/control/chargepoint/control_parameter.py:24`.
</issue_to_address>

### Comment 5
<location path="packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue" line_range="1036" />
<code_context>
+        pytest.param(6901, True, id="Überschuss reicht für min_current auf allen Phasen: umschalten"),
+        pytest.param(5000, False, id="Überschuss reicht nicht für min_current auf allen Phasen: nicht umschalten"),
+    ],
+)
+def test_check_phase_switch_conditions_required_surplus_based_on_min_current(surplus, expected_condition):
+    """ required_surplus muss auf control_parameter.min_current basieren. """
</code_context>
<issue_to_address>
**Automatik selection is ignored**

When a user selects Automatik in the Cards theme, the `selected_phases &&` guard rejects the selected value `0`, so `setChargePointConnectedVehiclePvChargingMinSocPhases()` does not update the saved phase selection.

Change the guard to accept `0` as a valid selection.
</issue_to_address>

### Comment 6
<location path="packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue" line_range="1039" />
<code_context>
+                  )
+                "
+              >
+                Automatik
+              </i-button>
             </i-button-group>
</code_context>
<issue_to_address>
**Automatic option is absent in served themes**

When the PR is deployed using the checked-in web assets without a separate frontend build, the deployed pages load the prebuilt files under `web/`, not these edited source components, so without rebuilding and including those files the new buttons do not appear to users.

Rebuild and include the generated web assets for each theme whose source changes in this PR.

Also at `packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/ConfigPv.vue:82`, `packages/modules/web_themes/koala/source/src/components/ChargePointPvSettings.vue:120`.
</issue_to_address>

### Comment 7
<location path="packages/control/ev/ev.py" line_range="324" />
<code_context>
             direction_str = f"Umschaltung von 1 auf {max_phases}"
-            required_reserved_power = (control_parameter.min_current * max_phases * 230 -
-                                       self.ev_template.data.max_current_single_phase * 230)
+            required_reserved_power = max(0, control_parameter.min_current * max_phases * 230 -
+                                          self.ev_template.data.max_current_single_phase * 230)

</code_context>
<issue_to_address>
**Use surplus above minimum**

The change adds automatic phase switching, but does not make available PV surplus raise the charging current above the minimum-SoC current. Thus the requested lower-bound behavior—and the choice between that behavior and a fixed minimum-SoC current—is still missing.
</issue_to_address>

Linked issues

#4005 Feature Request: "Mindest-Soc" so anpassen, dass kein PV-Überschuss eingespeist wird · 0 of 1 met

# Requirement Status Notes
1 Use available PV surplus during minimum-SoC charging while keeping the configured minimum-SoC current as a lower bound, with a choice to keep it fixed. 🟡 Partly met The new Automatik option can switch phases, but minimum-SoC charging still sets a fixed required current and does not use surplus to raise it; the charge point’s min_current also remains the vehicle’s general minimum.

Sourcery assessment

Approval pending. 7 findings to address first.

Blocking findings: packages/control/ev/ev.py:325, packages/control/ev/ev.py:448, packages/control/chargepoint/chargepoint.py:667, packages/control/ev/ev.py:389, packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue:1036, and 2 more


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread packages/control/ev/ev.py
Comment on lines +324 to +325
required_reserved_power = max(0, control_parameter.min_current * max_phases * 230 -
self.ev_template.data.max_current_single_phase * 230)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High · Minimum-SoC current floor is lost

When minimum-SoC charging uses automatic phase selection and its configured current exceeds the vehicle’s general minimum, set_control_parameter() puts the vehicle’s general minimum in min_current, which auto_phase_switch() uses for the switch threshold and target current. The switch can therefore charge below the configured minimum-SoC current.

Use the configured minimum-SoC current for the automatic switch threshold and target during minimum-SoC charging.

Also at packages/modules/web_themes/koala/source/src/components/ChargePointPvSettings.vue:120, packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue:1039, packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/ConfigPv.vue:82, packages/modules/web_themes/standard_legacy/web/index.html:959-960.

Prompt for AI agents
In `packages/control/ev/ev.py` at lines 324-325:

**Minimum-SoC current floor is lost**

When minimum-SoC charging uses automatic phase selection and its configured current exceeds the vehicle’s general minimum, `set_control_parameter()` puts the vehicle’s general minimum in `min_current`, which `auto_phase_switch()` uses for the switch threshold and target current. The switch can therefore charge below the configured minimum-SoC current.

Use the configured minimum-SoC current for the automatic switch threshold and target during minimum-SoC charging.

Also at `packages/modules/web_themes/koala/source/src/components/ChargePointPvSettings.vue:120`, `packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue:1039`, `packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/ConfigPv.vue:82`, `packages/modules/web_themes/standard_legacy/web/index.html:959-960`.

Comment thread packages/control/ev/ev.py
reserved = max(0, control_parameter.min_current * max_phases * 230 -
self.ev_template.data.max_current_single_phase * 230)
reserved = control_parameter.reserved_power
control_parameter.reserved_power = 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Reserved surplus remains unavailable

When a 1-to-3-phase delay has reserved power and the phase count changes from 1 before reset_phase_switch_delay() runs, reset_phase_switch_delay() releases and clears the reservation only when control_parameter.phases == 1, even though the charge-point update changes phases first. The reservation remains in reserved_surplus, reducing the surplus available to other charge points.

Release reserved_power and clear the delay reservation regardless of the current phase count.

Also at packages/control/chargepoint/chargepoint.py:191, packages/control/chargepoint/chargepoint.py:667, packages/control/ev/ev.py:449, packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue:1039, packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/ConfigPv.vue:82, packages/modules/web_themes/koala/source/src/components/ChargePointPvSettings.vue:120, packages/modules/web_themes/standard_legacy/web/index.html:960.

Prompt for AI agents
In `packages/control/ev/ev.py` at line 448:

**Reserved surplus remains unavailable**

When a 1-to-3-phase delay has reserved power and the phase count changes from 1 before `reset_phase_switch_delay()` runs, `reset_phase_switch_delay()` releases and clears the reservation only when `control_parameter.phases == 1`, even though the charge-point update changes phases first. The reservation remains in `reserved_surplus`, reducing the surplus available to other charge points.

Release `reserved_power` and clear the delay reservation regardless of the current phase count.

Also at `packages/control/chargepoint/chargepoint.py:191`, `packages/control/chargepoint/chargepoint.py:667`, `packages/control/ev/ev.py:449`, `packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue:1039`, `packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/ConfigPv.vue:82`, `packages/modules/web_themes/koala/source/src/components/ChargePointPvSettings.vue:120`, `packages/modules/web_themes/standard_legacy/web/index.html:960`.

if self.chargemode_changed or self.submode_changed:
data.data.counter_all_data.get_evu_counter().reset_switch_on_off(self)
charging_ev.reset_phase_switch_delay(self.data.control_parameter, self.get_max_phase_hw())
charging_ev.reset_phase_switch_delay(self.data.control_parameter)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Disabled automation strands phase delay

When the automatic minimum-SoC phase option is changed to a fixed phase while an automatic phase-switch delay is active, _check_auto_phase_switch_delay() stops servicing the delay once template_phases is no longer 0, while Chargepoint.update() calls reset_phase_switch_delay() only when the chargemode or submode changes. Changing the minimum-SoC phase selection from automatic to a fixed option during a delay therefore leaves the charge point in PHASE_SWITCH_DELAY with its surplus reservation held; the requested phase switch never completes.

Cancel and release an active automatic phase-switch delay when the selected phase mode changes away from automatic.

Prompt for AI agents
In `packages/control/chargepoint/chargepoint.py` at line 667:

**Disabled automation strands phase delay**

When the automatic minimum-SoC phase option is changed to a fixed phase while an automatic phase-switch delay is active, `_check_auto_phase_switch_delay()` stops servicing the delay once `template_phases` is no longer 0, while `Chargepoint.update()` calls `reset_phase_switch_delay()` only when the chargemode or submode changes. Changing the minimum-SoC phase selection from automatic to a fixed option during a delay therefore leaves the charge point in `PHASE_SWITCH_DELAY` with its surplus reservation held; the requested phase switch never completes.

Cancel and release an active automatic phase-switch delay when the selected phase mode changes away from automatic.

Comment thread packages/control/ev/ev.py
Comment on lines +388 to +389
).data.set.reserved_surplus -= control_parameter.reserved_power
control_parameter.reserved_power = 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Restored reservations are not released

When a restart or upgrade restores a pending phase-switch delay created before reserved_power existed, reserved_power defaults to zero, so the timeout and reset paths subtract zero instead of the existing reservation from reserved_surplus. Usable surplus remains understated after the delay ends or is cancelled.

Provide a compatibility fallback or migration that restores the prior reservation amount before the timeout and reset paths release it.

Also at packages/control/ev/ev.py:447-449, packages/control/chargepoint/control_parameter.py:24.

Prompt for AI agents
In `packages/control/ev/ev.py` at lines 388-389:

**Restored reservations are not released**

When a restart or upgrade restores a pending phase-switch delay created before `reserved_power` existed, `reserved_power` defaults to zero, so the timeout and reset paths subtract zero instead of the existing reservation from `reserved_surplus`. Usable surplus remains understated after the delay ends or is cancelled.

Provide a compatibility fallback or migration that restores the prior reservation amount before the timeout and reset paths release it.

Also at `packages/control/ev/ev.py:447-449`, `packages/control/chargepoint/control_parameter.py:24`.

setChargePointConnectedVehiclePvChargingMinSocPhases(
modalChargePointId,
0,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Automatik selection is ignored

When a user selects Automatik in the Cards theme, the selected_phases && guard rejects the selected value 0, so setChargePointConnectedVehiclePvChargingMinSocPhases() does not update the saved phase selection.

Change the guard to accept 0 as a valid selection.

Prompt for AI agents
In `packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue` at line 1036:

**Automatik selection is ignored**

When a user selects Automatik in the Cards theme, the `selected_phases &&` guard rejects the selected value `0`, so `setChargePointConnectedVehiclePvChargingMinSocPhases()` does not update the saved phase selection.

Change the guard to accept `0` as a valid selection.

)
"
>
Automatik

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High · Automatic option is absent in served themes

When the PR is deployed using the checked-in web assets without a separate frontend build, the deployed pages load the prebuilt files under web/, not these edited source components, so without rebuilding and including those files the new buttons do not appear to users.

Rebuild and include the generated web assets for each theme whose source changes in this PR.

Also at packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/ConfigPv.vue:82, packages/modules/web_themes/koala/source/src/components/ChargePointPvSettings.vue:120.

Prompt for AI agents
In `packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue` at line 1039:

**Automatic option is absent in served themes**

When the PR is deployed using the checked-in web assets without a separate frontend build, the deployed pages load the prebuilt files under `web/`, not these edited source components, so without rebuilding and including those files the new buttons do not appear to users.

Rebuild and include the generated web assets for each theme whose source changes in this PR.

Also at `packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/ConfigPv.vue:82`, `packages/modules/web_themes/koala/source/src/components/ChargePointPvSettings.vue:120`.

Comment thread packages/control/ev/ev.py
direction_str = f"Umschaltung von 1 auf {max_phases}"
required_reserved_power = (control_parameter.min_current * max_phases * 230 -
self.ev_template.data.max_current_single_phase * 230)
required_reserved_power = max(0, control_parameter.min_current * max_phases * 230 -

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High · Use surplus above minimum

The change adds automatic phase switching, but does not make available PV surplus raise the charging current above the minimum-SoC current. Thus the requested lower-bound behavior—and the choice between that behavior and a fixed minimum-SoC current—is still missing.

Prompt for AI agents
In `packages/control/ev/ev.py` at line 324:

**Use surplus above minimum**

The change adds automatic phase switching, but does not make available PV surplus raise the charging current above the minimum-SoC current. Thus the requested lower-bound behavior—and the choice between that behavior and a fixed minimum-SoC current—is still missing.

From #4005:

Use available PV surplus during minimum-SoC charging while keeping the configured minimum-SoC current as a lower bound, with a choice to keep it fixed.

@LKuemmel
LKuemmel merged commit a7250a5 into openWB:master Nov 4, 2026
9 checks passed
@seaspotter
seaspotter deleted the min-soc-automatic-phases branch November 4, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Feature Request: "Mindest-Soc" so anpassen, dass kein PV-Überschuss eingespeist wird

4 participants