Repository navigation
Octopus: move to the new API domain, api.oegb-kraken.energy (#5786) - #5799
chalfontchubby wants to merge 12 commits into
Conversation
…5786) Octopus is moving its public API from api.octopus.energy to api.oegb-kraken.energy. Both are live now, and the old one will be switched off in a few months. - Predbat's own requests (the Octopus component, the annual tariff catalogue and annual consumption) now go to the new domain, through one constant in const.py. - A rates_import/export_octopus_url, compare tariff or annual tariff that still names api.octopus.energy is rewritten to the new domain when it is fetched, with a log line asking for apps.yaml to be updated. Existing configs keep working after the switch-off. - Saved annual runs naming the old domain still match their catalogue entry. - Saving sessions stay on api.backend.octopus.energy. It has no new- domain equivalent: savingSessions returns 400 on the new domain. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Update the Octopus product URLs in the docs, the example apps.yaml and the templates to the new API domain. The rates and compare pages say that old-domain URLs keep working, because Predbat rewrites them, and that users should change them anyway. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ates (#5786) - The "please update apps.yaml" notice is now a Warn, given once per URL rather than on every 5-minute cycle. - Rates cached under the old address before the upgrade move to the new one, so a failed first download after the upgrade still falls back to them rather than raising. - An old-domain URL with an explicit port or a fragment is rewritten too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
springfall2008
left a comment
There was a problem hiding this comment.
Automated comment from the triage bot.
Review of head a5b6016 (Octopus domain move to api.oegb-kraken.energy, closes #5786): the change is sound. Traced every path a user-supplied Octopus URL can reach — fetch.py import/export rates (fetch.py:1500, fetch.py:1584), compare.py export entries (compare.py:258), the annual engine's _resolve_url (annual_tariff.py:117) and the catalogue matching on both sides (match_entry, tariff_catalogue.py:216-221, which migrates both the saved run and the catalogue entry, so a saved run naming the old address still re-selects its dropdown entry) — all funnel through migrate_octopus_url. Predbat's own URLs all build from OCTOPUS_API_URL; no live code path in apps/predbat still names the old host, and templates/docs/apps.yaml/coverage fixtures are URL-only swaps (scanned every changed line for smuggled-in changes). The cache carry-over plus warn-once in download_octopus_rates is covered by test_octopus_domain, registered in TEST_REGISTRY as a non-slow test, and the migration regex's edge cases (look-alike hosts, ports, embedded next= links, non-strings) are covered. Saving/free sessions stay on api.backend.octopus.energy as documented. 2 low findings inline, 0 in the body.
… URL Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The new host's paginated responses still link further pages on api.octopus.energy, so page 2 onwards of a rate or consumption download went back to the old host and would fail once it is retired. Run each next link through migrate_octopus_url() in the four places that follow one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…wnloads 150438d tested only the sync rate download. Point the existing pagination fixtures for the async OctopusAPI download, the annual tariff and the annual consumption download at the old host, and check page 2 is fetched from the new one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Posted by Claude on behalf of @chalfontchubby. Two commits added since the bot review:
I've updated the PR description to match. |
Conflicts in octopus.py only: kept main's session factory and imports alongside this branch's OCTOPUS_API_URL constants. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # templates/hanchu_cloud.yaml
solis_local.yaml arrived on main (#6088) after this branch moved every other template to the new Octopus API domain. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main replaced requests with http_sync (#6153), so octopus.requests no longer exists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Posted by Claude on behalf of @chalfontchubby. Live test on a real install: the new domain works for Octopus Direct, saving sessions and tariff comparison. The annual tariff path has not run yet. Setup. The PR branch was merged with current main (it merges cleanly) and deployed to a Home Assistant install. That install uses Octopus Direct (account and API key) on Intelligent Octopus Go, joins saving sessions, and has a 12-entry Octopus Direct. From the first cycle, every account query went to Saving sessions. The Compare. A manual compare run:
As a cross-check, fetching four of those products' rates directly from both hosts gave identical results. Not covered. The annual tariff and annual consumption downloads did not run during the test. 🤖 Generated with Claude Code |
|
Posted by Claude on behalf of @chalfontchubby. Confirmed working live, so I've removed Since the test described above, the same install has run this branch for about 19 hours, overnight included. Over that time every Octopus Direct call went to The annual tariff tool was not exercised. It only runs on demand from the 🤖 Generated with Claude Code |
# Conflicts: # apps/predbat/utils.py
Opened by Claude on Rik's behalf.
Closes #5786
Octopus is moving its public API from
api.octopus.energytoapi.oegb-kraken.energy. Both are live now, and the old domain will be switched off "in a few months" (Octopus forum, 29 Sep). This PR moves Predbat to the new domain. It also keeps existing configs working after the switch-off, so users don't have to edit anything first.What changes
OCTOPUS_API_URLinconst.py. That covers the Octopus Direct component (REST and GraphQL), the annual tariff catalogue and annual consumption.rates_import_octopus_url/rates_export_octopus_url, compare tariff or annual tariff that still namesapi.octopus.energyis rewritten to the new domain when it is fetched (utils.migrate_octopus_url).Warn:line, given once per URL, asks the user to update apps.yaml.api.octopus.energy, so eachnextlink is rewritten as well. That covers the rate downloads, annual tariff and annual consumption.api.backend.octopus.energy. It has no new-domain equivalent: asavingSessionsquery returns 400 onapi.oegb-kraken.energy, andapi.backend.oegb-kraken.energydoesn't resolve.energy-rates.md,compare.md,apps-yaml.md, the annual docs, the exampleapps.yamland the templates now point at the new domain. The rates and compare pages say that old URLs keep working, and that users should change them anyway.Evidence
Read-only checks with a real account key, run on 27 Oct:
/v1/accounts/(basic auth),obtainKrakenTokenand GraphQLviewerqueries all work on the new domain.JWTprefix, so no new API key is needed.savingSessionsonapi.backend.octopus.energy.Unauthenticated checks on 28 Oct, using the exact query strings in
octopus.py:nextlinks on the old host.Risk
Tests
New
octopus_domaintest covering:{dno_region};nextlink on the old host fetched from the new one. Existing pagination tests for the async, annual tariff and annual consumption downloads cover this too.It fails on main.
Existing fixtures were moved to the new domain.
./run_all --quickandrun_pre_commitpass.🤖 Generated with Claude Code