Skip to content

fix(car): let control: true filter a charger Octopus drives through octopus_intelligent_planned_slot - #5816

Open
tico24 wants to merge 4 commits into
springfall2008:mainfrom
tico24:fix/charger-octopus-veto
Open

tico24 wants to merge 4 commits into
springfall2008:mainfrom
tico24:fix/charger-octopus-veto

Conversation

@tico24

@tico24 tico24 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #5808. Until that merges the diff here includes it, and the commits after #5808's are new.

What and why

A charger Octopus drives is always left to Octopus, even when the user filters Octopus's dispatches through octopus_intelligent_planned_slot and sets the charger's control setting to true. With this change Predbat drives that charger to its plan, so it runs only in the dispatches the planned sensor keeps and is stopped in the ones the filter drops. Without a planned sensor nothing changes: a charger Octopus drives is still left alone, whatever its control setting. Car 0's Ohme slots stay with the Ohme.

This is the veto question raised on #5808. It matters once Predbat can tell that an Octopus Energy integration device is a charger (chalfontchubby's is_charger work with the #3034 fix). Without it, that change hands a filtered charger back to Octopus and the filter stops working.

Octopus bills a dispatch half hour off-peak only when the car draws in it, but the rate feed marks every raw dispatch off-peak. A dispatch the planned sensor drops never reaches octopus_slots, so the surplus strip never saw it, and Predbat kept the off-peak price on a half hour the filtered charger won't run in. Predbat now puts the day rate back on those minutes, the same way it does for a dispatch no car needs, from the current half hour unless the car has already drawn in it. The fixed 23:30 to 05:30 window, the Ohme and cars Predbat doesn't filter are unchanged. On 30 Oct this let Predbat grid-charge my house battery in a dispatch half hour Octopus listed for a car that was already full.

Who this changes things for

  • Users of Predbat's Octopus or Kraken component with an Octopus-driven charger, its control setting true and octopus_intelligent_planned_slot set. Predbat left the charger to Octopus, and now filters it.
  • Integration users with the same setup, once Predbat can tell their device is a charger. Until then they're "cannot tell", so control: true already drives the charger, and fix(car): follow octopus_intelligent_planned_slot when driving a charger #5808 makes it follow the planned sensor.

How Octopus responds to the stops

My Octopus-driven Hypervolt has been stopped inside the dispatches my filter drops since 14 Oct, by Home Assistant automations at first and by Predbat since 24 Oct.

  • Octopus keeps starting the charger inside the dispatch, so the stop has to be put back each time. One dispatch during an export on the night of 15 Oct needed 8. Predbat already puts a drifted charger back every cycle.
  • Half hours held off at 0 W weren't listed in completed_dispatches (23:00 to 23:30 on 14 Oct), so they didn't count toward the 6 hour cap. A half hour with any draw does: a one-minute overrun past a dispatch end on 15 Oct was listed with 0.12 kWh.
  • Octopus has kept planning dispatches for the car throughout. A full car held off in every dispatch never looks idle to Octopus, so it keeps planning for it.

I can't see how Octopus scores a dispatch internally, so none of this rules out it counting these as failed dispatches.

Testing

  • test_octopus_charger_filtered_through_a_planned_sensor covers an is_charger charger left to Octopus without a planned sensor, stopped and started to the planned sensor with one, handed back to Octopus when the control setting goes, and car 0's Ohme slots left out. It fails on fix(car): follow octopus_intelligent_planned_slot when driving a charger #5808's code.
  • test_dispatches_the_planned_sensor_drops_get_the_day_rate covers a dropped dispatch later in the day and in the current half hour, the current half hour once the car has drawn, a dispatch the planned sensor keeps, the fixed window and a car Predbat doesn't filter. It fails without the last commit. dispatch_billing_window, dynamic_load_car, octopus_slots and iog_car_need_gate pass too.
  • car_charger_control, hypervolt, ohme, myenergi and ge_cloud pass. pre-commit passes on the changed files.
  • My system has run this rule since 28 Oct, with a Home Assistant template sensor as octopus_intelligent_planned_slot.

@github-actions github-actions Bot added the BOT_REVIEW Trigger an autotriage label Oct 28, 2026

@springfall2008 springfall2008 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated comment from the triage bot.

Reviewed at 97f3f93. Note for readers: this PR is stacked on #5808 (still open), so GitHub's diff here spans both PRs until that merges; #5808's part was reviewed earlier in a different shape (3c2dac7) and its current shape is reviewed here together with this PR's commit.

The change is sound. What I verified by reading (no PR code executed): the new filtered arm reuses the planned-sensor rule from #5808 and that rule matches Fetch.car_planned_slot_entity() and its caller on all four veto cases (not set, re:-prefixed, the slot sensor itself, octopus_intelligent_slot_action_config in use) - regex-matching is done by autoconfig upstream, so both sides see resolved entity IDs; the Ohme-claimed car 0 exclusion in filtered matches the claim short-circuit in charger_control_octopus_drives_charger(), and the new test's claimed case does drive that check (the claim makes drives True there); control settings parse through parse_control_setting in all five charger components, so charger_control_config is True is a real bool; ComponentBase.get_arg delegates to the base, so a component reading the root-level octopus_intelligent_planned_slot sees the user's apps.yaml value; the hand-over ("release" not "on") when control: true goes away matches charger_control_hand_to_octopus()'s never-start-a-charge rule; both new tests are called from run_car_charger_control_tests() and the module is in TEST_REGISTRY (unit_test.py:797); both docs files are updated and correctly describe the new rule, and their remaining claims (dispatch reads against the clock, completed lists merged) match the code.

Findings: 1 inline, 1 in the body.

  • docs/car-charging.md:712 — the pre-existing octopus_intelligent_charging paragraph now contradicts the new rule; details in the inline comment.
  • apps/predbat/car_charger_control.py:135 — charger_control_setup()'s docstring still lists only the old meanings of control: true; details below.

Comment thread docs/car-charging.md Resolved
The shared charger loop also runs a charger in any dispatch on octopus_intelligent_slot, so a dispatch the planned sensor leaves out still started it, although the car plan ignores those. Planned dispatches now come from octopus_intelligent_planned_slot where it is set, and completed ones from both sensors, as fetch.py reads them. With a planned sensor set there is no fallback to the slot sensor on/off state, which would put back the dispatches the planned sensor filtered out.
…topus_intelligent_planned_slot

A charger Octopus drives was always left to Octopus, so a user who filters the dispatches through a planned sensor could not stop it in the ones the filter drops. With the control setting true and a planned sensor set for that car, Predbat now drives it to its plan and the planned dispatches. Without a planned sensor it is still left to Octopus, and car 0 slots claimed by the Ohme stay excluded.
…ensor filters out of a charger Predbat runs

A raw dispatch that octopus_intelligent_planned_slot leaves out never reaches octopus_slots, so the rate feed's off-peak price stayed on it although a filtered charger draws nothing in it and Octopus bills it at the day rate. Strip those minutes like the minutes no car needs, from the current half hour when the car has not drawn in it.
@tico24
tico24 force-pushed the fix/charger-octopus-veto branch from 22cf836 to 3015dd2 Compare November 16, 2026 05:54

This branch has not been deployed

No deployments
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.

2 participants