Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
Hey - I've found 6 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="core/loadpoint_effective.go" line_range="220-221" />
<code_context>
// effectiveMaxCurrent returns the effective max current
func (lp *Loadpoint) effectiveMaxCurrent() float64 {
+ // no current control, min current is the expected draw
+ if lp.chargerHasFeature(api.SwitchDevice) {
+ return lp.effectiveMinCurrent()
+ }
+
</code_context>
<issue_to_address>
**Power-limited maximum is discarded**
When a switch-device charger exposes a power limiter whose reported minimum is below its maximum, a switch device also implements `api.PowerLimiter` and reports different minimum and maximum powers, so `effectiveMaxCurrent` returns the minimum-demand current and skips the existing maximum-power cap; plan durations and load estimates then use the lower demand instead of the device’s maximum power.
For switch devices with a power limiter, derive the effective maximum from the limiter’s maximum power rather than returning the effective minimum.
</issue_to_address>
### Comment 2
<location path="core/loadpoint_effective.go" line_range="220" />
<code_context>
// effectiveMaxCurrent returns the effective max current
func (lp *Loadpoint) effectiveMaxCurrent() float64 {
+ // no current control, min current is the expected draw
+ if lp.chargerHasFeature(api.SwitchDevice) {
+ return lp.effectiveMinCurrent()
+ }
</code_context>
<issue_to_address>
**Switch loads remain variable in optimizer**
When a switch device supports phase switching and retains an automatic phase configuration, `EffectiveMinPower` still uses `minActivePhases`, while `EffectiveMaxPower` uses `maxActivePhases`; for a switch device with automatic phase switching, those differ (1 vs. 3), so the optimizer receives different `CMin` and `CMax` instead of a fixed load.
Ensure switch devices use the same phase count for effective minimum and maximum power, or explicitly set optimizer `CMin` equal to `CMax` for them.
</issue_to_address>
### Comment 3
<location path="core/loadpoint_api.go" line_range="865" />
<code_context>
if current > lp.maxCurrent {
- return errors.New("min current must be smaller or equal than max current")
+ if lp.chargerHasFeature(api.SwitchDevice) {
+ lp.setMaxCurrent(current)
+ } else {
+ return errors.New("min current must be smaller or equal than max current")
</code_context>
<issue_to_address>
**Stale maximum survives interrupted update**
When the process exits after `lp.setMaxCurrent` persists the raised value but before `lp.setMinCurrent` persists the expected value, `lp.setMaxCurrent` has already published and persisted the raised maximum while `lp.setMinCurrent` has not run, so a restart loads a higher maximum with the old minimum; if the charger is later changed from a switch device to a controllable charger, the stale maximum becomes an active limit.
Persist the paired min/max update atomically, or add recovery logic that reconciles the pair on startup.
</issue_to_address>
### Comment 4
<location path="assets/js/components/Config/LoadpointModal.vue" line_range="922" />
<code_context>
+ set(power: number) {
+ const current = powerToCurrent(
+ power,
+ this.minPhases,
+ this.voltage,
+ this.gridConnection
</code_context>
<issue_to_address>
**Expected power uses wrong phase count**
When a switch device’s configured phase count is unset or does not match its actual phases, `expectedPower` passes `minPhases` to `powerToCurrent`, so an unset count defaults to one and a stale count of three is used even for a single-phase device. `values.minCurrent` is then wrong, and the displayed estimate and effective power no longer match the entered power.
Use the switch device’s actual active phase count when converting expected power to `minCurrent`.
Also at `core/loadpoint_effective.go:220-221`.
</issue_to_address>
### Comment 5
<location path="assets/js/components/Config/LoadpointModal.vue" line_range="250-254" />
<code_context>
+ <PropertyField
+ id="loadpointExpectedPower"
+ v-model="expectedPower"
+ type="Int"
+ unit="W"
+ size="w-25 w-min-200"
+ required
+ @input="updateExpectedPower"
+ />
+ <span class="evcc-gray text-nowrap power-hint">
</code_context>
<issue_to_address>
**Zero expected power is ignored**
When a user submits 0 W for expected power, `DynamicConfig.Apply` treats `minCurrent == 0` as unset and skips `SetMinCurrent`, so the previous expected draw remains in effect after saving.
Ensure submitting 0 W clears the expected draw instead of treating it as an omitted value.
Also at `assets/js/components/Config/LoadpointModal.vue:926`.
</issue_to_address>
### Comment 6
<location path="assets/js/components/Config/LoadpointModal.vue" line_range="243" />
<code_context>
+ <FormRow
+ v-if="chargerIsSwitchDevice"
+ id="loadpointExpectedPower"
+ :label="$t('config.loadpoint.expectedPowerLabel')"
+ :help="$t('config.loadpoint.expectedPowerHelp')"
+ >
</code_context>
<issue_to_address>
**Expected-power term lacks glossary entry**
The new “Expected power” label names the switch device's expected draw, but that concept has no entry in the glossary, leaving the user-facing terminology without an agreed translation for future strings.
Add a glossary entry for the expected-power concept and its translations.
</issue_to_address>Linked issues
#35656 maxcurrent bei Switchsocket sollte gleich mincurrent gesetzt werden · 1 of 1 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Use the minimum current as the maximum current for switch devices so calculations do not use the default 16 A. | ✅ Met | For switch devices, effectiveMaxCurrent follows effectiveMinCurrent; plan power uses the effective maximum, and the setters raise or clamp the stored maximum when needed. |
Contributor
There was a problem hiding this comment.
Linked issues
#35656 maxcurrent bei Switchsocket sollte gleich mincurrent gesetzt werden · 0 of 1 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Set switch-device maxcurrent equal to mincurrent so calculations do not use the default 16 A. | 🟡 Partly met | Effective maximum current now follows effective minimum current, but the stored maxcurrent remains 16 A when mincurrent is lower. |
This reverts commit 33bab04.
Contributor
Linked issuesChecked at commit 4613843 #35656 maxcurrent bei Switchsocket sollte gleich mincurrent gesetzt werden · 1 of 1 met
|
Member
Taking phases into account? We need to decide if min==max should be enforced. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #35656, part of #19753
Loadpoints on chargers without current control (
switchdevice) configure one expected power instead of phases and min/max current. For these, min current already is the "draw when on" and max only feeds estimates, so one value covers both.effectiveMaxCurrentfollows min current for switch devices. Fixes plan duration and PV reserve computed with the 16 A default.CMin==CMax, instead of a 0 to 3.7 kW range.minCurrent, no new field or migration.Intfields block decimal separator keys.Follow-up: docs rename.
🤖 Generated with Claude Code