EV-21: Solar cuts the car first for the quarter peak
infra-pin / fresh (pull_request) Successful in 2s
checks / unit (pull_request) Failing after 1h10m59s

In Solar, when the 15-minute period heads over the aim and the batteries
would have to give more, the car is lowered first: floor((car - excess) /
(230 x phases)) A, 0 under 6 A. At once without real headroom (saturated,
floor-limited, excess beyond what the batteries can add, no battery figure,
cover off, last 120 s), else after at most 15 s. One cut per episode from
its start, deeper only on a growing excess; restart with the start power
under the aim for the start time; none after a 2nd cut in the period.

Grading (formal C2): a Solar car Solar cannot cut is graded, banked and
left in the guard as in Off. A Solar car is never banked. Grey note and Why
"Solar lowered the car for the peak." Manual and Off unchanged.

Tests: test_ev21.py, test_ev21_paths.py, test_ev21_same.py; T49 in
tools/ev20_day.py; T50 in test_ev20_fuzz.py; test_ev20_guard section 8
moved from "as Manual" to "as Off" where Solar cannot cut (T51).

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ems-agent
2026-11-25 17:01:07 +01:00
co-authored by Claude
parent a8e4ceb859
commit 7bc8988be0
17 changed files with 2175 additions and 85 deletions
+26 -3
View File
@@ -3374,13 +3374,26 @@ changes at most once per 30 seconds and only by 1 A or more.
seconds, Solar writes nothing over it (also no 0 A), shows an amber row and
logs one warning, until you press Solar again or the charger shows Solar's
value.
- **The peak limit** treats a Solar car exactly as a Manual car (below). Solar
does not slow the car for the peak in this version.
- **The peak limit: the car is cut first.** When the 15-minute period heads
over the peak limit and the batteries would have to give more for it, Solar
lowers the car first: by the excess, to 0 A when less than 6 A would be left.
It waits at most 15 seconds, and only while the batteries can still give
more; it does not wait when they are at full power or at the peak reserve,
when a battery reading is missing, with `ev_batt_cover` off, or in the last 2
minutes of the period. One cut per excess; it goes deeper only if the excess
grows. The car comes back when the period, with the car at 6 A, has been
under the limit for the start time (`ev_start_min`); after a second cut in a
period, it waits for the next period. While this works, the card says
"Solar lowered the car for the peak." and one grey note says the same. When
Solar cannot lower the car (another writer, shadow mode, a stop, a charger
fault, or a lower current the charger has not shown yet), the peak alarms
treat the car as in Off. A Solar charge is never counted as setting the
month's peak.
- **Energy.** The card says "{kWh} charged today, {kWh} from the sun", and the
sensor `goodwe_car_today_solar_kwh` has the sun's part. Only Solar's own
share of spare sun counts, not the hold's battery or grid power.
**The car is never slowed for the peak limit.** A Manual charge goes on whatever
**Manual: the car is never slowed for the peak limit.** A Manual charge goes on whatever
the 15-minute peak does. With the default `ev_batt_cover` on, the batteries help
cover it down to the peak reserve; a 3-phase 16 A charge (11 kW) can empty two
batteries to the reserve in about 1.5 hours, and the month's peak then rises by
@@ -3576,6 +3589,15 @@ alarm. It is raised once per charging session. To stay under the limit, lower th
current. In Solar it says "Solar charges the car at {a} A, which sets the
peak.": the same case, with the current the charger has.
### Car lowered for the peak
In Solar mode the 15-minute period was heading over the peak limit, and the
add-on lowered the car first, before the batteries gave more. Nothing needs
doing: the car comes back by itself when the period allows it. It is raised
once per charging session.
*For installers: card EV-21.*
### Charger kept its current
The add-on started without writing to the charger (shadow mode, or control
@@ -3618,6 +3640,7 @@ default `info` hides it.
| No prices | warning | `goodwe_no_prices` | PRICE-01 |
| Charger not reachable | warning | `goodwe_charger_unreachable` | EV-03 |
| Car over the peak limit | info | `goodwe_car_over` | EV-04 |
| Car lowered for the peak | info | `goodwe_car_cut` | EV-21 |
**The Details link.** Home Assistant 2026.2 and newer show add-on pages at
`/config/app/<slug>/documentation`; 2026.5 removed the old