Commit 308f348
fix(execute): resolve multi-inverter status from all inverters, not just the last one processed (#4466)
* fix(execute): resolve multi-inverter status from all inverters, not just the last one processed
execute_plan()'s headline status was a single variable overwritten once per
inverter in the loop, so the dashboard silently showed whichever inverter
happened to be processed last - hiding real disagreement between inverters,
including genuine cross-charging (one inverter charging while another
discharges at the same time), which gcoan confirmed is a real, known
phenomenon on multi-inverter Sigenergy/GivEnergy-style systems.
Track each inverter's own final core state in status_per_inverter (keyed by
id, so an inverter passing through multiple assignments in its own
processing still just keeps its own last value). After the loop, resolve
one headline via resolve_multi_inverter_status(): if inverters disagree
across the charge/export divide, surface it as "Cross-charging" rather than
picking one side arbitrarily; if they only disagree on sub-state within the
same side (e.g. one still Charging, another already Hold charging), show
the most active one, since that's what the fleet is actually still doing
overall.
Extracted as a small pure function for direct unit testing rather than
needing to drive execute_plan()'s full branching to construct genuine
multi-inverter disagreement scenarios.
Three existing execute.py tests (charge_imbalance2, charge_freeze_imb1,
charge_freeze_imb4) asserted the old "last inverter wins" artifact as if it
were correct (e.g. "Hold charging" when one inverter was actually still
charging toward target) - updated to assert the corrected, more informative
aggregate instead.
Fixes #4446
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* feat(execute): include each inverter's own state in the status tooltip
Follow-on to the #4446 headline fix. The status_extra text (the "detail"
attribute on predbat.status, shown as the tooltip/more-info text) already
concatenated each inverter's SoC->target numerically for multi-inverter
setups ("target 80%-40% / 60%-40%") but didn't say which state each entry
belonged to. Prefix each entry with that inverter's own state
("target Charging 80%-40% / Hold charging 60%-40%") - reuses the existing
append pattern and status_per_inverter/status values already computed for
the #4446 fix, no new machinery. Single-inverter setups are unaffected.
Added assert_status_extra to the shared execute test harness and locked in
real values for charge_imbalance2 and charge_freeze_imb1, which already
exercise genuine multi-inverter disagreement.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* docs: document the new Cross-charging status
gcoan asked on #4466 for the new multi-inverter Cross-charging status
(introduced by resolve_multi_inverter_status()) to be documented alongside
the other predbat.status values.
* fix(execute): don't let a Charging/Exporting fleet state suppress the iBoost hold status text
status_hold_iboost was only ever set inside the same guard (status not in
["Exporting", "Charging"]) that gates the actual discharge-pause actions, so
the annotation could never be recorded once any inverter's status reached
Charging/Exporting. Split the guard so it still gates the pause/reserve
actions but the status text update always runs, matching the pattern already
used by the car-holding block just above it.
* fix(execute): keep the iBoost hold status text and Calibration headline correct on multi-inverter fleets
The final commit of this PR decoupled the "Hold for iBoost" status annotation
from the pause action it describes - the annotation became a sibling of the
inner discharge-hold guard instead of nested inside it, so it could now fire
whenever the outer iBoost condition held, regardless of whether a pause
actually happened this cycle. Re-nest it so the annotation stays coupled to
boostHolding actually firing.
Also fixes resolve_multi_inverter_status() so a Calibration break correctly
overrides any stale core state an earlier-processed inverter left in
status_per_inverter, matching what the function's own docstring already
claimed but didn't implement.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(output): recognise Cross-charging as export activity in the yesterday-plan reconstruction
Cross-charging (#4466) contains "charging" but not "exporting" as a string,
so calculate_yesterday()'s slot classification silently dropped the export
half of a genuine cross-charging minute, showing it as plain charging only.
Add yesterday_slot_is_exporting() and use it at both the search and the
window-building call sites.
Also clarifies (no behaviour change) that find_charge_curve()'s exact-match
status checks deliberately exclude Cross-charging minutes from curve
learning - another inverter is drawing/feeding power at the same time, so
the sample isn't a clean single-inverter reading. And tightens the
Cross-charging doc entry, which described it as both inverters "genuinely"
charging/exporting when it also fires for two merely-holding sub-states
(Hold charging + Hold exporting) with no current actually flowing.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test: cover both #4466 fixes through their real integration paths
Both fixes were previously only covered at the extracted-function level
(resolve_multi_inverter_status / yesterday_slot_is_exporting), which proves
the helper's logic but not that the surrounding code actually reaches it.
Add the two integration cases and verify each genuinely fails when its fix
is reverted:
- execute: "calibration_after_charging_inverter" drives execute_plan() with a
real two-inverter fleet where inverter 0 reaches Charging before inverter 1
enters calibration and breaks the loop. Without the fix the headline
resolves back to the stale "Charging". Needed per-inverter escape hatches
(in_calibration_array and the immediate-target/isCharging asserts) because
the break leaves the fleet genuinely half-processed - the test now documents
that real state rather than papering over it.
- calculate_yesterday: a full "Cross-charging" status history must rebuild both
charge AND export windows. Captured from inside a publish_html_plan mock,
since the reconstructed windows only exist between the fake-window block and
the restore at the end of the function. Without the fix the export side comes
back empty.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Trefor Southwell <48591903+springfall2008@users.noreply.github.com>
Co-authored-by: Trefor Southwell <tdlj@tdlj.net>1 parent 9ad008e commit 308f348
8 files changed
Lines changed: 404 additions & 43 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
29 | 74 | | |
30 | 75 | | |
31 | 76 | | |
| |||
40 | 85 | | |
41 | 86 | | |
42 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
43 | 93 | | |
44 | 94 | | |
45 | 95 | | |
| |||
198 | 248 | | |
199 | 249 | | |
200 | 250 | | |
| 251 | + | |
201 | 252 | | |
202 | | - | |
| 253 | + | |
203 | 254 | | |
204 | 255 | | |
205 | 256 | | |
206 | 257 | | |
207 | 258 | | |
208 | 259 | | |
| 260 | + | |
209 | 261 | | |
210 | 262 | | |
211 | 263 | | |
| |||
240 | 292 | | |
241 | 293 | | |
242 | 294 | | |
| 295 | + | |
243 | 296 | | |
244 | 297 | | |
245 | 298 | | |
246 | | - | |
| 299 | + | |
247 | 300 | | |
248 | 301 | | |
249 | 302 | | |
| |||
378 | 431 | | |
379 | 432 | | |
380 | 433 | | |
| 434 | + | |
381 | 435 | | |
382 | | - | |
| 436 | + | |
383 | 437 | | |
384 | 438 | | |
385 | 439 | | |
| |||
398 | 452 | | |
399 | 453 | | |
400 | 454 | | |
| 455 | + | |
401 | 456 | | |
402 | | - | |
| 457 | + | |
403 | 458 | | |
404 | 459 | | |
405 | 460 | | |
406 | 461 | | |
407 | 462 | | |
| 463 | + | |
408 | 464 | | |
409 | 465 | | |
410 | | - | |
| 466 | + | |
411 | 467 | | |
412 | 468 | | |
413 | 469 | | |
| |||
477 | 533 | | |
478 | 534 | | |
479 | 535 | | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
497 | 545 | | |
498 | | - | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
499 | 559 | | |
500 | 560 | | |
501 | 561 | | |
| |||
628 | 688 | | |
629 | 689 | | |
630 | 690 | | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
631 | 695 | | |
632 | 696 | | |
633 | 697 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1152 | 1152 | | |
1153 | 1153 | | |
1154 | 1154 | | |
1155 | | - | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
1156 | 1160 | | |
1157 | 1161 | | |
1158 | 1162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
55 | 66 | | |
56 | 67 | | |
57 | 68 | | |
| |||
3183 | 3194 | | |
3184 | 3195 | | |
3185 | 3196 | | |
3186 | | - | |
| 3197 | + | |
| 3198 | + | |
| 3199 | + | |
| 3200 | + | |
3187 | 3201 | | |
3188 | 3202 | | |
3189 | 3203 | | |
3190 | 3204 | | |
3191 | 3205 | | |
3192 | 3206 | | |
3193 | 3207 | | |
3194 | | - | |
| 3208 | + | |
3195 | 3209 | | |
3196 | 3210 | | |
3197 | 3211 | | |
| |||
3206 | 3220 | | |
3207 | 3221 | | |
3208 | 3222 | | |
3209 | | - | |
| 3223 | + | |
3210 | 3224 | | |
3211 | 3225 | | |
3212 | 3226 | | |
| |||
0 commit comments