Skip to content

car_charging_plan_smart produces two opposite failure modes depending on max_price — blocks all planning at 0p, wildly over-plans (including peak-rate slots) at 30p #4416

Description

@jHamshaw

Title: Created with the assitance of Claude....

Summary

With switch.predbat_car_charging_plan_smart On for both cars, input_number.predbat_car_charging_plan_max_price produced two distinct, reproducible bugs depending on its value:

  • At 0p: zero car charging ever planned, regardless of a genuine, large SoC-to-target gap and a confirmed real Octopus IOG dispatch slot.
  • At 30p: car charging planned wildly in excess of what's physically possible, including repeatedly at 30.27p peak rate — the opposite of what "smart" price-aware planning should do.

It should be noted that this is IoG with the charge cap switched on.... Octopus move the slots around a lot more now, particularly during house peak day rate times....

Evidence — max_price = 0p (blocks everything)

Debug log/ History Plan - consistent across every plan cycle:

Cars 2 charging from battery False planned [False, False], charging_now [False, False]
smart [True, True], max_price [0.0, 0.0]p, plan_time ['06:30:00', '06:30:00'],
battery size [77.0, 84.0]kWh, limit [61.6, 67.2]%, rate [7.4, 7.4]kW, exclusive [True, True]

At the time, Car 1 (EV6) had a genuine SoC of 34.5% against a real configured target of 80% (number.ev6_ac_charging_limit = 80) — a ~45.5% gap (~35kWh on an 84kWh battery) — with a confirmed live Octopus dispatch slot (03:00–07:30, 07:30–08:00, matching the Octopus app). Despite this, planned [False, False] and zero Car kWh appeared anywhere in the 48-hour plan.

Secondary bug spotted in the same log line: limit [61.6, 67.2]% does not match either car's real configured target (80% for both). Working backwards: 80 × 0.77 = 61.6 and 80 × 0.84 = 67.2 — i.e. each car's real 80% target appears to be getting multiplied by its own car_charging_battery_size (in kWh) ÷ 100, which looks like an internal scaling bug (percentage being treated as if it needed dividing by a kWh-based factor). This didn't block planning on its own (both scaled-down limits were still above current SoC), but could plausibly cause a car to stop charging early in other circumstances where the true target and the miscalculated one straddle the real SoC.

Evidence — max_price = 30p (wildly over-plans)

After raising car_charging_plan_max_price to 30 (comfortably above the 6.9p cheap rate, below the 30.27p standard rate), the very next plan showed:

  • Total car energy planned: 74.66kWh across 48 hours — exceeding the combined capacity of both cars' batteries (77kWh + 84kWh) from completely flat, despite the real remaining need being ~13kWh (EV6 at 64.5%→80% on an 84kWh battery) and the VW showing as full.
  • Car energy planned repeatedly during 30.27p peak-rate slots, e.g.:
Sat 15:00  30.27p  ...  Car kWh 5.22
Sat 15:30  30.27p  ...  Car kWh 7.12
Sat 16:00  30.27p  ...  Car kWh 6.70
Sat 16:30  30.27p  ...  Car kWh 5.16
Sat 17:00  30.27p  ...  Car kWh 6.78
Sat 17:30  30.27p  ...  Car kWh 6.72
Sat 18:30  30.27p  ...  Car kWh 4.94
Sat 19:00  30.27p  ...  Car kWh 7.14

This is the opposite of what a price-capped ("max price to pay") smart planner should do — a 30p cap should exclude 30.27p slots entirely (they're above the cap), yet they're where most of the phantom energy is concentrated.

System context

  • 2-car setup, single shared Zappi charger, car_charging_exclusive: [true, true]
  • octopus_intelligent_charging: true, car_charging_slots correctly pointing at the live IOG dispatch sensor (confirmed matching the real Octopus app slots)
  • car_charging_only_charge_plugged_in: true, car_charging_assume_needs_full_charge: false
  • Both car_charging_plugged_in sensors confirmed correctly reflecting real-world plug state at time of testing
  • Predbat version: v8.46.4–v8.47.x (across the testing window)

Question for maintainers

Given both failure modes trace to the same smart/max_price mechanism, and the 0p case's debug log also shows a plausible unrelated scaling bug on limit, it may be worth checking whether car_charging_plan_max_price is being compared against the correct per-slot rate at all (e.g. compared in the wrong units, or against a stale/default rate rather than each slot's actual price) — that would explain both a 0p cap blocking real cheap slots and a 30p cap somehow not excluding 30.27p slots. Turning car_charging_plan_smart off entirely (relying on car_charging_slots + basic SoC-to-target logic) appears to avoid both failure modes in initial testing.

History Plan :

History Plan.pdf

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions