fix: SolarStopTimer unreachable in multi-node solar mode#119
Merged
basmeerman merged 1 commit intomasterfrom Mar 27, 2026
Merged
fix: SolarStopTimer unreachable in multi-node solar mode#119basmeerman merged 1 commit intomasterfrom
basmeerman merged 1 commit intomasterfrom
Conversation
The SolarStopTimer threshold formula scaled linearly with ActiveEVSE, making it impossible to trigger in multi-node setups. With 2 EVSEs on 3-phase at 6A min, the threshold was 32A — but the mains meter only showed ~20A because solar partially offset EV consumption. Result: secondary nodes kept charging at MinCurrent indefinitely despite no solar surplus. Root cause: upstream commit 94ca08e introduced Isum > (ActiveEVSE * MinCurrent * Phases - StartCurrent) * 10 which is correct for single-EVSE but scales the threshold unreachably high for multi-node (68A for 4 EVSEs, 140A for 8). Fix: remove ActiveEVSE from the threshold, using single-EVSE minimum: Isum > (MinCurrent * Phases - StartCurrent) * 10 This is correct because priority scheduling already handles which cars charge and which are paused. The SolarStopTimer should only fire when there isn't enough solar for even one car at MinCurrent. Single-EVSE behavior is unchanged (ActiveEVSE was 1). Adds 24 new tests in test_multi_node_solar.c covering: - Multi-node solar shortage and SolarStopTimer lifecycle - Threshold boundary verification (above/below) - Solar + capacity tariff interaction - Power delivery pause vs session/OCPP lifecycle - Mode consistency (Solar vs Normal vs Smart) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
basmeerman
added a commit
that referenced
this pull request
Mar 27, 2026
Test infrastructure grew from 47→50 suites and 1,046→1,096 tests after merging multi-node solar fix (PR #119, +24 tests) and mode sync fix (PR #121, +8 tests). Updated all documentation references: - CLAUDE.md, README.md, CONTRIBUTING.md: test count references - docs/quality.md: 4 occurrences of test metrics - docs/upstream-differences.md: added both fixes as upstream divergences - docs/manual-test-plan.md: test count reference - test-specification.md: regenerated (70 features, 1,082 scenarios) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3 tasks
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.
Summary
ActiveEVSEmultiplier from SolarStopTimer threshold inevse_state_machine.c, making it based on a single-EVSE minimum instead of scaling with the number of active nodes(ActiveEVSE * MinCurrent * Phases - StartCurrent) * 10made the threshold unreachable in multi-node setups (32A for 2 EVSEs, 68A for 4, 140A for 8) — priority scheduling already handles which cars chargetest_multi_node_solar.ccovering shortage detection, timer lifecycle, threshold boundaries, capacity tariff interaction, and power-delivery-vs-session verificationBug context
Real-world issue: secondary EVSE kept charging at 6A (MinCurrent) in solar mode with no solar surplus. Debug log showed
SolarStopTimer: 0(never started) because mains import (20.7A) was below the 2-EVSE threshold (32A). The bug exists in upstream (dingo35/SmartEVSE-3.5, commit94ca08e).What changed
One-line fix in
evse_state_machine.c:910:Single-EVSE behavior is unchanged (ActiveEVSE was 1).
Test plan
test_multi_node_solar.c— all passNew test groups
🤖 Generated with Claude Code