Skip to content

Codex/merge predbat update - #18

Merged
calvind80 merged 25 commits into
feature/modern-web-uifrom
codex/merge-predbat-update
Nov 7, 2026
Merged

calvind80 merged 25 commits into
feature/modern-web-uifrom
codex/merge-predbat-update

Conversation

@calvind80

Copy link
Copy Markdown
Owner

Fixed web_security test issue

springfall2008 and others added 25 commits November 7, 2026 09:34
…gfall2008#6018)

With soc_max unset, battery_size_tracking wrote its estimate back with
set_arg("soc_max"), so the next cycle read it as configured: the [0.8, 1.0]
clamp and find_battery_size's plausibility band then held every later
estimate near the first one. The estimate is no longer written back; each
cycle recovers it from sensor.predbat_soc_max_calculated.

With no measurement in its history that sensor's state is just the nominal
it was published with. With soc_max unset that is an old configured size
(e.g. a Sunsynk installer-entered Batt Capacity bound as soc_max before
soc_max_fallback), so it is no longer read back as a measured mean.

A day whose calculation finds nothing is now retried hourly instead of
waiting for the next midnight UTC, which comes just before an overnight
charge. The attempt time is kept on the sensor as last_attempt, since an
Inverter is rebuilt every cycle and the sensor survives a restart.

Co-authored-by: CI <ci@example.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…rve (springfall2008#5997)

* fix(gateway): clamp the export target sent to the gateway to the reserve

The planner uses an export limit of 0 to mean "export as far as allowed",
and execute.py resolves that against the reserve before driving other
inverters. The gateway plan hook sent export_target_of(limit) through
unchanged, so the gateway was told to stop a force export at 0-4% and
ran the battery below the user's minimum SoC.

Send max(target, reserve_percent) instead. Freeze export already used
the reserve. The low-power fraction test is moved to a 4% reserve so it
still checks a 5% target.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(gateway): floor plan export targets at max(reserve, best_soc_min), test tuple encoding

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: CI <ci@example.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…tch (springfall2008#5663) (springfall2008#5984)

* fix(iog): drop the discount the rate feed keeps for a withdrawn dispatch (springfall2008#5663)

The Octopus Energy integration's import rate sensor lowers the price of
dispatch minutes and marks them is_intelligent_adjusted, and was seen to
keep doing so for half an hour after Octopus withdrew the dispatch. Every
check on that discount keys on the dispatch list, so once the dispatch
had gone the plan charged the battery through those minutes at what was
really the day rate.

octopus_strip_withdrawn_feed_rates() sets a feed-discounted minute from
now on, outside the fixed 23:30-05:30 window, back to the base rate when
its half hour is covered by no car's dispatch now (planned, completed or
held) but was at an earlier cycle. A discount no dispatch has ever
covered is left alone, as the feed may be ahead of the dispatching
sensor or there may be none. The half hour in progress is left alone
while a car reads charging or with octopus_intelligent_dynamic off, and
nothing is stripped under the window billing rule. compare.py applies it
to a refetched feed too, so the live tariff still matches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(iog): strip nothing while a car is charging, as Octopus empties the planned list while it re-plans a running session (springfall2008#5663)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(iog): keep the half hours seen covered across a restart, and test the fetch call site (springfall2008#5663)

octopus_feed_covered was memory-only, so a restart while the rate feed still carried a
withdrawn dispatch's discount brought the springfall2008#5663 plan back. It is now saved to storage on
change and restored at start up, as the held half hours are (octopus_held_save/load).

The fetch_sensor_data() call site had no test: all scenarios called the strip directly. A new
test runs the real fetch up to rate_replicate() and checks the withdrawn half hour is at the
day rate with its markers gone, and a still-listed one keeps both. It fails with the call
removed or moved after rate_replicate().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: CI <ci@example.com>
…dates); correct the MCP entry fixed by springfall2008#5992 (springfall2008#6012)

Folded: springfall2008#5130 false-alarm discriminator, springfall2008#5444 session-slot design, springfall2008#5773 started_dispatches never priced, springfall2008#5850 balancer mask (fixed by springfall2008#5870), springfall2008#5852 debug-history retention + control-failure event shapes, Solis three-route hold map + Demo handover + first-cycle decode, springfall2008#5854 display-vs-kernel, springfall2008#5855 fill double-count rewrite, springfall2008#5856 Monitor-not-read-only, springfall2008#5860 export depth + replay probes, springfall2008#5866 spread arithmetic, springfall2008#5868 GE Cloud timestamps. Sharpened only: springfall2008#5851 (already covered).

Co-authored-by: CI <ci@example.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
…of freezing it (springfall2008#5998)

Hold charging with the SoC above the target disables the charge window and
writes the hold reserve, then fell through to the charge immediate block,
which froze the battery. On an inverter with no target SoC the freeze
service is the vendor's hold mode (Back-up on FoxESS), which ignores the
reserve, so the battery was pinned and the house imported for the whole
window. Stop the charge instead while the SoC is above the reserve, so
the battery covers the house; freeze as before once it reaches the reserve.
…springfall2008#5964) (springfall2008#5965)

The per-cycle replication warning fired on every 5-minute plan between the
component's ~4-hourly polls, because a 48h forecast's reach decays below a
48h plan as it ages. Warn once per fetch when the API itself publishes short,
and only escalate the per-cycle message to a warning when less than 24h of
the plan is covered.

Co-authored-by: CI <ci@example.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…exist for Ohme chargers (springfall2008#5933) (springfall2008#5934)

Co-authored-by: CI <ci@example.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…r templates (springfall2008#5912) (springfall2008#5931)

The Tesla Powerwall, Teslemetry, Sigenergy SigenStor, Sofar Modbus and both
Solar Assistant Growatt templates carried the octopus_saving_session block but
not octopus_free_session, so Octopus free-electricity / Power Up events got no
0p rate for users who started from them. Add the same block every other
template ships, plus a test that every template with a saving-session entry
also ships a free-session pattern that resolves a free-session event entity.

Co-authored-by: CI <ci@example.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…st sensor (springfall2008#6014)

Systems with no PV forecast source never get sensor.predbat_pv_forecast_raw,
so its relative_time attribute is None and fetch_pv_forecast() logged
"Unable to parse relative_time" every cycle. Midnight UTC is already the right
default there, so only warn when relative_time is present but unparseable.

Fixes springfall2008#6013
…all2008#5956)

manual_all_times, the slots under any manual charge, export, demand or
freeze override, is what the optimiser and the rate-window scan leave
alone. It was stored beside the five per-type lists it is built from
and kept in step by hand: fetch rebuilt it each cycle, reset(), annual
and compare cleared it alongside the lists, compare saved and restored
it, and a debug dump saved its own copy. The replay never rebuilt that
copy, so clearing a manual override from a dump's lists still held its
slots back from the optimiser - which hid the reported evening export
when replaying the springfall2008#5943 dump with its manual demand blocks cleared.

It is now a read-only property worked out from the five lists, so it
cannot disagree with them anywhere, and the hand-kept copies go.
find_charge_window() takes it once as a set rather than rebuilding it
for every minute it scans; plan timing on the debug cases is unchanged.

Debug dumps still write it, derived, for an older Predbat replaying the
dump. read_debug_yaml() skips it, as it does any key that is now a
property, so a dump's saved copy is never restored - and warns when the
saved copy disagrees with what the rest of the dump derives, since then
what replays is not what was planned live. The dump loading in
run_single_debug() moves into load_debug_dump() so a test can load a
small dump without planning from it. Tests set the per-type lists
(clear_manual_times() in test_infra clears all five, and reset_inverter()
uses it) instead of assigning manual_all_times.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…e the clone clean (springfall2008#6019)

A plain `gitnexus analyze` rewrites six tracked files: the GitNexus section of
AGENTS.md and CLAUDE.md, and the four skills under .claude/skills/gitnexus/. It
undoes the markdownlint fixes main carries, so every flow after main moved
started on a dirty clone. unfinished_cleanup_reason() counted those files as
unpushed fixes, so PR springfall2008#5997's cleanup was marked BOT_FAILED on 2026-11-06 even
though it had pushed its commit. --index-only rebuilds the index without
editing any tracked file.

Co-authored-by: CI <ci@example.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…up (springfall2008#5556) (springfall2008#5909)

* feat(solis): write a parallel master's slot current for the whole group (springfall2008#5556)

On two Solis inverters in parallel on one battery bank, the master's
slot current is shared by the pair. Predbat plans each inverter at its
own rate and set each one's slot to its own share, so the master's slot
carried half of what was planned: a pair that runs at 270A between them
ran at 67A each.

New, both optional and off by default:
- solis_parallel_slaves maps each master's serial number to its slave(s).
  When the master's slots are written, each slave's planned current for
  the same slot and direction is added to the master's own.
- solis_parallel_slot_current_max caps that total, from the battery
  bank's rating. Without it the master's own battery limit still binds,
  so nothing is assumed about what a shared bank can take.

Each inverter is still planned at its own rate. The slot probe now
records the upper limit it probed against, and probes afresh when that
changes, so a master probed at its own 135A is not held there for a day
or re-checked 1A at a time up to the group limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(solis): parallel group review fixes (springfall2008#5556)

- Decode a parallel master's slot current as its even share of the
  group's total, so a restart doesn't add the slaves to it again or
  show the total as the master's own.
- Count a slave listed twice only once, and warn about a master with no
  slave or a group limit set without solis_parallel_slaves.
- Reject non-finite and boolean group limits.
- Base the 0A Feed-in rule on the group's charge current.
- Warn once that a master not in TOU V2 mode gets no group total, and
  say so in the docs.
- Don't count a probe upper-limit change while a battery limit register
  is unread, and have the CLI print the limits the writes use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(solis): decode a parallel master's share as its register less the slaves' currents

An even split of the master's register was only right when every member
shared equally and every slave was enabled. Members are planned at their
own rates and an idle slave adds nothing, so a restart could decode
185A (135A + 50A) as 92.5A and rewrite the group's current down to
142.5A before Predbat re-asserted it.

The share is now the register less exactly what parallel_slot_current()
adds back, so an unchanged schedule decodes to an unchanged register.
The first poll decodes masters after their slaves so their currents
are known.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(solis): decode parallel masters after their slaves on the TOU reload and cleanup paths too

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ringfall2008#5908)

The FB00 setup said "the Solax Modbus integration" without a link or
saying it is the one the GS_fb00 type is written for. Users on another
Solis integration have set up GS_fb00 without the Energy Storage
Control Switch, so freezes and holds were never enforced (springfall2008#5834, springfall2008#5852).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…gfall2008#5911)

* fix(gateway): five follow-ups from the Hub live display review (springfall2008#5714)

- A screen turned off (gateway_display_enabled: false) revokes the live
  display binding instead of renewing it every 60s while _publish_raw
  blocks the data.
- gateway_display_enabled and gateway_live_display read 0/1 as false/true
  and fall back with a warning on anything else, instead of raising in
  initialize and taking the whole Gateway component (and inverter control)
  down over a screen preference. gateway_display_only still fails loudly.
- predbat_status, predbat_status_detail and block_state are cut by UTF-8
  bytes, without splitting a character, to fit the firmware buffers.
- _publish_raw returns whether it sent; predbat_data dedup only advances
  after a real send, so a payload dropped while disconnected goes out on
  reconnect.
- An oversized live packet warns at most every 15 minutes, not every cycle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MFXkZpTYzEXmRJqRwNqFgr

* docs(gateway): screen-off revokes the live binding; strings never reach the fallback

- docs/hub-live-display.md names screen-off (gateway_display_enabled: false)
  as a trigger for live_display {enabled:false}, and says a live feed
  stopping when the screen is turned off is expected.
- parse_display_preference's docstring says apps.yaml strings are already
  coerced by get_arg's resolve_arg, so its fallback covers values passed
  directly and non-string types only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MFXkZpTYzEXmRJqRwNqFgr

---------

Co-authored-by: Claude <noreply@anthropic.com>
…08#5871) (springfall2008#5878)

* feat(plan): show the PV10 and PV90 outcomes in plan tooltips (springfall2008#5871)

The plan is scored against the expected forecast and its PV10 and PV90
alternatives, but the table shows only the expected one, so a decision
driven by another scenario looks wrong with no way to see why (springfall2008#5566).

Keep the final plan's PV10 SoC and metric series, add a PV90 run of the
final plan when PV90 is enabled, and carry each scenario's SoC, PV,
load, slot cost and running total on the plan rows that differ. The
field order and scenario names are published once per plan. The live
plan's HTML and the web UI plan view show them as title= tooltips on
the SoC, PV, load, cost and total cells. History, compare and debug-pass
tables are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(plan): one scenario per line in the plan tooltips (springfall2008#5871)

Join the tooltip's scenarios with a line break rather than a comma, and
write a negative running total as the Total column does (-£2.25, not
£-2.25), in both the HTML plan and the web UI plan view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(plan): short scenario labels, and only the SoC tooltip in the HTML plan (springfall2008#5871)

The HTML plan repeats each tooltip on every row, so five tooltips with
long scenario names grew it by 38-67%. Name the scenarios Expected,
Pessimistic (PV10) and Optimistic (PV90), and keep only the SoC tooltip
in the HTML. The web UI still builds all five from the compact row JSON.
The HTML plan is now 5-8% larger than before.

Review fixes:
- Leave PV10 out when pv_metric10_weight is 0, as PV90 already is: the
  plan is not scored against it.
- On the web UI's editable SoC and load cells, put the tooltip on the
  value rather than the cell, so it doesn't cover the override menu.
- Say why compare's saved state lists the scenario series.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(plan): tooltip only where a cell's scenarios differ; test calculate_plan (springfall2008#5871)

Review fixes:
- Show a cell's tooltip only when its own value differs between
  scenarios. The running total nearly always differs, so every cell got
  one, including a night PV cell of three "0.00 kWh" lines.
- In the web UI, write the Total tooltip as that view's Total column does
  (£-2.25), and escape the tooltip text.
- The HTML only needs the SoC tooltip now, so its formatter is SoC only.
- Test calculate_plan(): PV90 is run on the final plan while weighted and
  cleared when not, and the expected run stays last.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(plan): scenario tooltip review fixes, round three (springfall2008#5871)

- Take the PV10 PV and load from the arrays the PV10 run used, held on
  the instance, rather than the caller's, so a tooltip never pairs a
  scenario's SoC with PV it wasn't simulated against.
- Find each field by name in the published field order, not by a fixed
  position in the web UI.
- Write the cost as the Cost column does ("+5 p"), and a cost rounding
  to -0 pence as +0.
- Correct the compare.py comment: a debug-mode pass does write the PV10
  series.
- The test restores the weight and the PV10 arrays it changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(plan-card): describe the pessimistic and optimistic scenario tooltips (springfall2008#5871)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…gain (springfall2008#6015) (springfall2008#6022)

render_chart() closed the ApexCharts options literal with a bare '}' and
the springfall2008#5980 title script that follows starts with '(function() {'. A line
starting with '(' continues the previous statement, so browsers parsed
'var options = {...}(function() {...})()' as a call on the options object,
threw 'TypeError: ... is not a function' and never created the chart -
every render_chart() page was blank in v9.7.0.

Co-authored-by: CI <ci@example.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…pringfall2008#6020) (springfall2008#6021)

* fix(teslemetry): use self_consumption when the signal tariff is flat (springfall2008#6020)

Under signal-tariff control the idle state was autonomous with a flat 50p
tariff, which gives Tesla's optimiser no price reason to cover house load,
so a Powerwall could leave small loads on the grid with the reserve already
released. The idle mode now follows the tariff: self_consumption when no
window is in it, autonomous once a charge window is committed or an export
window has started. Mode and tariff share one helper, so they cannot
disagree.

The forced re-assert now re-sends the tariff as well, and only resets its
timer once the tariff push has also succeeded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(teslemetry): note the forced tariff re-push and the Self-Powered idle mode (springfall2008#6020)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: CI <ci@example.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@calvind80
calvind80 merged commit 7814062 into feature/modern-web-ui Nov 7, 2026
11 of 14 checks passed
@calvind80
calvind80 deleted the codex/merge-predbat-update branch November 7, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants