batpred icon indicating copy to clipboard operation
batpred copied to clipboard

Octopus Intelligent with only the charger enrolled: dispatches are trimmed against car 0's SoC whichever car is plugged in

Open chalfontchubby opened this issue 5 days ago • 1 comments

Posted by Claude on behalf of @chalfontchubby.

Summary

With only the charger enrolled in Octopus Intelligent (not the car), Octopus doesn't know which car is plugged in. It sizes every dispatch from the single car profile in the Octopus app. Predbat attributes all of those dispatches to the car whose octopus_intelligent_slot entry it is (normally car 0), and then trims and costs them against that car's SoC, limit and battery size, whichever car is actually on the charger. With two cars on one enrolled charger (#6178), the plan models the wrong car charging.

What happens (from #6178's data)

  • One myenergi Zappi enrolled as a charger (is_charger: true). Two cars in apps.yaml: car 0 is 82 kWh with its own SoC sensor; car 1 is 24 kWh, a different car with no Octopus enrolment.
  • Charge target: weekday_target_soc: 20, which for a charger means "add 20%". The next night's planned dispatches total about 17.6 kWh, which is 20% of the 82 kWh profile plus losses.
  • octopus_intelligent_consider_full is on. load_octopus_slots() trims dispatch energy to car_charging_limit[0] - car_charging_soc[0], so it uses car 0's sensor even when car 1 is the car on the charger.
  • When car 1 charges:
    • car 0's SoC doesn't move, so its modelled need never shrinks;
    • car 1, which can only take a fraction of a 16 kWh dispatch, gets none of the dispatch's energy in the plan;
    • the plan holds the house battery and prices the car load for energy that does not reach car 0.
  • The #3034 "add X%" base SoC (octopus_charge_target_base_soc) is captured from car 0 at plug-in, so it is also wrong whenever the other car is plugged in.

What can and can't be known

With a charger enrolled, Octopus gives Predbat the dispatch windows with their charge_in_kwh, and the cheap house rate during them. Octopus never says which car is plugged in, so any SoC-based trimming has to assume a car. Per-car plug sensors driven by a manual "which car is on the charger" switch (the recipe in docs/car-charging.md) can say which car is plugged in, but docs/car-charging.md already says that recipe does not suit a charger-only enrolment.

Proposal

  1. When the enrolled device is a charger (detected, or forced by the setting proposed in #6429) and more than one car can use that charger, skip the car-SoC trimming for that car, as if octopus_intelligent_consider_full were off. Take the dispatches' charge_in_kwh at face value and rely on the dynamic dispatch check (car_charging_now) to drop slots the car doesn't use. Skip the "add X%" base-SoC logic too.
  2. Documentation: in docs/car-charging.md, give an explicit recipe for one enrolled charger shared by several cars:
    • num_cars: 1 representing the charger;
    • car_charging_planned from the charger's plug status, with a correct response list;
    • car_charging_now from the charger's power;
    • no car_charging_soc;
    • octopus_intelligent_consider_full off.
  3. Optional, larger, only if asked for: let the charger's dispatches follow whichever car's plug sensor is on, converting charge_in_kwh into that car's SoC and capping it at what that car can take.

Related: #6178, #3034 / #5822, #5726, #5783.

chalfontchubby avatar Nov 29 '26 11:11 chalfontchubby

Automated first-pass triage — a maintainer will review this before any action is taken.

Classification: bug · Priority: low

What Predbat does wrong: with only a charger enrolled with Octopus Intelligent and more than one car configured, every Intelligent dispatch is bound to the car holding the octopus_intelligent_slot entry (normally car 0), and with octopus_intelligent_consider_full on, load_octopus_slots() trims and prices those dispatches against that car's SoC and limit — so the plan models the wrong car charging whenever the other car is the one on the charger.

What I checked

The 28 Nov log and debug file attached to #6178 (Predbat v9.10.2, confirmed from the log), against main 03832173. From the debug file:

num_cars: 2
octopus_intelligent_slot:
- "binary_sensor.predbat_octopus_..._intelligent_dispatch_..."
car_charging_soc:
- "sensor.volvo_ex40_battery"          # 82 kWh
- "sensor.car_dacia_battery"           # 24 kWh
octopus_intelligent_consider_full: true
octopus_intelligent_ignore_unplugged: false

and the dispatch sensor carries is_charger: true. There is no car_charging_now in apps.yaml (Predbat's own log says car(s) [0] have no car_charging_now sensor).

That matches the report, and the mechanism is where you describe it:

  • fetch_sensor_data_cars() builds each car's dispatch list in range(min(len(octopus_intelligent_slot), num_cars)), so with one entry all the dispatches land on car 0 and car 1 gets none.
  • load_octopus_slots(car_n, ...) reads car_charging_soc[car_n] and car_charging_limit[car_n], and with octopus_intelligent_consider_full on it caps the dispatch to that car's remaining headroom and ends the slot where it is reached. So car 0's sensor is what the trimming is measured against whichever car is plugged in.
  • The "add X%" base SoC (#3034) is computed only for the car in that loop, i.e. car 0, so its limit becomes car 0's SoC + 20% of 82 kWh whatever car is actually on the charger.

Two things worth noting for the fix:

  1. octopus_intelligent_consider_full defaults to Off. With it off, load_octopus_slots() takes each dispatch's charge_in_kwh at face value, so the extra phantom car load only appears on installs that have turned the expert switch on — which narrows this to charger-only enrolment and two or more cars and that switch on.
  2. The dynamic dispatch check will not reassign the slot by itself. dynamic_load_car_evidence() treats any car's car_charging_now reading "charging" as charging for every car (the #5725 fix for two chargers), so while the other car charges the dispatch stays trusted and stays on car 0. Proposal 1 alone therefore removes the wrong trimming, but getting the energy and SoC onto the car actually plugged in needs proposal 3; proposals 1 and 2 together are the achievable part.

is_charger detection for proposal 1 already exists (utils.intelligent_device_is_charger(), used by octopus_charge_target_is_added()), so "the enrolled device is a charger" can be read without a new setting. #6429 would give it an explicit override if that matters here.

Not shown by this data

The attached log (27 Nov 22:05 to 28 Nov 21:40) has no night where the second car charged — its SoC does not move in it — so the wrong plan is confirmed from the config and the code, not seen happening. If you can capture a predbat.log and the debug snapshot (Plan → History, Debug column) covering a night the other car charges, that would let us verify the plan-side effect before changing anything. It isn't blocking the decision on the proposal.

Suggested change

  • Code: when the enrolled device is a charger and more than one car can use it, skip the car-SoC trimming and the "add X%" base for that car even with octopus_intelligent_consider_full on (proposal 1).
  • Docs: the recipe for one enrolled charger shared by several cars (proposal 2). docs/car-charging.md already says the manual-switch recipe "does not suit that setup", so the alternative is currently missing.

Workaround in the meantime

Turn octopus_intelligent_consider_full off (it is the default), and set car_charging_now from the charger's live power so the dispatch check can see a dispatch the car is not using. The other option is to describe the charger to Predbat as one car (num_cars: 1, plug/power from the Zappi, no car_charging_soc), which loses per-car SoC tracking but matches what Octopus itself is doing.

Related

Related to #6429 (let the user say car or charger), #5726 and #5783 (relating one charger to more than one car), and #3034 / #5822 (charger-enrolled "add X%" target).

springfall2008 avatar Nov 29 '26 11:11 springfall2008