Repository navigation
fix(car): let control: true filter a charger Octopus drives through octopus_intelligent_planned_slot - #5816
fix(car): let control: true filter a charger Octopus drives through octopus_intelligent_planned_slot#5816tico24 wants to merge 4 commits into
Conversation
springfall2008
left a comment
There was a problem hiding this comment.
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_chargingparagraph 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.
0565c6c to
22cf836
Compare
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.
…hever way the Octopus switch is set
…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.
22cf836 to
3015dd2
Compare
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_slotand sets the charger's control setting totrue. 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_chargerwork 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
trueandoctopus_intelligent_planned_slotset. Predbat left the charger to Octopus, and now filters it.control: truealready 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.
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.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_sensorcovers anis_chargercharger 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_ratecovers 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_slotsandiog_car_need_gatepass too.car_charger_control,hypervolt,ohme,myenergiandge_cloudpass. pre-commit passes on the changed files.octopus_intelligent_planned_slot.