Repository navigation
fix(ohme): leave the Intelligent car slots to Octopus when the Intelligent device is the car - #5405
Merged
Merged
Conversation
…igent device is the car With ohme_automatic on and ohme_automatic_octopus_intelligent unset, the Ohme component took the Intelligent car slots for itself on any Intelligent tariff. Where the device Octopus Intelligent drives is the car and not the Ohme, Octopus schedules the charge through the car, and Ohme's session has nothing to do with the dispatches (#5402). Auto-detection now looks at the Octopus component's live, non-suspended Intelligent devices. The Ohme takes the slots when it is one of them, or when the account has no Intelligent device at all. When Octopus drives another device the slots are left to the Octopus component, Ohme's own schedule is not used as the plan, and ohme_control stands down. With every device suspended there are no dispatches, so Ohme's schedule is the plan at the tariff rate. The Octopus component now re-wires the car slots when their owner changes, so they are picked up when Ohme gives up a claim it made before the device was known. Fixes #5402 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Ownership release can incorrectly erase Ohme’s schedule for suspended devices or restore stale dispatch wiring after leaving an Intelligent tariff.
Review effort: Balanced
Findings: 1
What changed in this PR
Updates Ohme/Octopus Intelligent coordination so charging slots follow the device controlled by Octopus.
Changes:
- Detects whether Octopus controls the Ohme charger or another device.
- Rewires slot ownership when the controlled device changes.
- Adds regression tests and documentation.
| File | Description |
|---|---|
apps/predbat/ohme.py |
Selects slots based on the Intelligent device. |
apps/predbat/octopus.py |
Reconfigures slots after ownership changes. |
apps/predbat/tests/test_ohme.py |
Tests device detection and transitions. |
apps/predbat/tests/test_octopus_intelligent_devices.py |
Tests ownership-based rewiring. |
docs/car-charging.md |
Documents slot-selection behavior. |
docs/components.md |
Clarifies Ohme auto-detection. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
… to wire them to Review feedback on #5405. The Ohme component also gives up its claim on the car slots when there are no dispatches to be had from anyone - the Intelligent device suspended, or the tariff no longer Intelligent - and then wires them to the charger's own schedule. The owner-change re-wire added in this PR ran automatic_config() in those cases too: - with every device suspended it cleared the wiring Ohme had just made; - off an Intelligent tariff, where the device list is not refreshed and still holds the old device, it overwrote it with stale dispatch entities. The re-wire now only runs when the slots were released and there is a live, non-suspended device on a tariff that is still Intelligent; otherwise the new owner is just noted. automatic_config() also only clears car slot wiring that is still what it last put there, as the device-set change that follows a suspension would otherwise clear the same wiring one refresh later. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
chalfontchubby
added a commit
that referenced
this pull request
Oct 6, 2026
…alone when Octopus drives the car, unless asked to follow it When the car itself is the Octopus Intelligent device, the car starts and stops its own charge. Predbat now leaves the charger alone by default, handing over a charger it held without starting a charge, as it does when Octopus drives the charger. The new expert-mode switch, default off, has Predbat drive the charger to the car's dispatches instead, so the car cannot also charge on its own timers. The Ohme follows the same switch: with it on, ohme_control can run while Octopus drives the car, where #5405 otherwise stands it down. A change of the switch is picked up on the next Ohme poll. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #5402. Builds on #5401, which is merged.
The problem
With
ohme_automatic: trueandohme_automatic_octopus_intelligentunset, the Ohme component took the Intelligent car slots for itself whenever the import tariff was an Intelligent one. It never checked which device Octopus Intelligent controls.When that device is the car (a BMW, Mini or Volkswagen linked to Octopus directly) and not the Ohme, Octopus schedules the charge through the car and the Ohme is only the socket. Predbat was then planning from Ohme's session, target and ready time, and ignoring Octopus's own dispatch list. The issue has an example: Octopus reporting no dispatches and 80% by 18:40, while Predbat worked from a 12-hour, 91 kWh Ohme slot to 100% by 11:52.
What this changes
Auto-detection now looks at the Octopus component's Intelligent devices as well as the tariff. On an Intelligent tariff with the flag unset:
ohme_controlstands downAn explicit
ohme_automatic_octopus_intelligent: trueorfalsestill wins, and the Ohme is still registered as the charger (car_charging_planned,car_charging_now,car_charging_energy) in every case.Decisions worth a look
is_chargertrue and providerOhme(case-insensitive), as the issue proposed. A charger of another make on the account is treated like the car: Octopus keeps the slots.OctopusAPI.automatic_config()already does for its own wiring. This does change behaviour for an Ohme whose smart charging is suspended in the Octopus app: its slots used to be priced as cheap dispatches and are now car load at the tariff rate. That seems right, since Octopus is not dispatching it, but it is wider than the issue's example.ohme_controlis ruled out when Octopus drives another device, not only when the slots come from Ohme. Otherwise Predbat would pause and max-charge the Ohme while Octopus is scheduling the car through it. With an explicitohme_automatic_octopus_intelligent: falseit is still allowed, as before.How it works
octopus_intelligent_wanted()reads the devices throughOctopusAPI.get_intelligent_devices(). That list only holds live devices and is kept through a failed poll, so it does not flap with the API. A newoctopus_other_deviceflag records "Octopus is driving something that is not this charger", andcharger_slots_wanted()refuses the charger-schedule mode from feat(ohme): take the car plan from Ohme's own schedule when Predbat is not controlling the charger #5401 while it is set.OctopusAPI.run()now re-wires the car slots when their owner changes. If Ohme claimed the slots before the device was known and then gives the claim up, the device set has not moved, so nothing else would have wired them. This is the one change outsideohme.py.Testing
test_ohme.py: the detection rules for each device combination (Ohme, car, other charger, both, suspended, none, explicit flag, non-Intelligent tariff); a first run with the car as the device, with and without Octopus's wiring already in place, and withohme_control; and a running install where the device is found late, swapped for the Ohme, then suspended.test_octopus_intelligent_devices.py: the Octopus component leaves the slots alone while Ohme holds them, wires its own entity on the next sensor refresh after Ohme lets go, and does not repeat that../run_all --quickpasses.Docs:
docs/car-charging.md(the auto-detect description and the "Which car charging plan Predbat shows" table) and the Ohme entry indocs/components.md.🤖 Generated with Claude Code