Summary
The Kraken component wires metric_octopus_export into fetch.py whenever an export tariff is discovered, regardless of whether any export rate data was actually fetched. For tariffs whose rate endpoint returns no data (e.g. EDF SEG export tariffs, which 404 on standard-unit-rates), this wires metric_octopus_export to an empty export_rates sensor. That empty sensor then takes precedence over the user's manual rates_export fallback, so all export is dropped from the plan and the manual export rate can never take effect.
Affected component
apps/predbat/kraken.py — KrakenAPI.run()
Root cause
In run():
# Fetch export rates if export tariff is known
if self.export_tariff:
export_rates = await self.async_fetch_rates(tariff=self.export_tariff)
if export_rates:
... # publish export_rates sensor
# Wire export into fetch.py once export tariff is discovered
if not self.export_wired and self.export_tariff:
self.set_arg("metric_octopus_export", self.get_entity_name("sensor", "export_rates"))
self.export_wired = True
The wiring is gated only on self.export_tariff (tariff discovered), not on export rates actually being retrieved. An export tariff can be discovered (registered on the meter point) while the rate endpoint returns nothing.
In fetch.py, export-rate selection is an if/elif/else chain where metric_octopus_export is checked by key presence:
elif "metric_octopus_export" in self.args:
entity_id = self.get_arg("metric_octopus_export", None, indirect=False)
self.rate_export = self.fetch_octopus_rates(entity_id) # empty
...
else:
self.rate_export = self.basic_rates(self.get_arg("rates_export", [], ...), "rates_export") # never reached
Because the key is present (even pointing at an empty sensor), the else branch that would use the user's manual rates_export is never reached.
Production evidence (EDF SEG customer)
Warn: Kraken: Rates HTTP 404 for
https://api.edfgb-kraken.energy/v1/products/EDF_EXPORT_SEG_12M/electricity-tariffs/E-1R-EDF_EXPORT_SEG_12M_HH-B/standard-unit-rates/
Warn: ...'metric_octopus_export' element sensor.predbat_kraken_..._export_rates returned value 'None', not a valid value
Warning: No export rate data provided
The EDF account has the export tariff EDF_EXPORT_SEG_12M registered (so it's discovered), but Kraken's standard-unit-rates endpoint 404s for it — SEG export tariffs don't publish half-hourly unit rates. A manual rates_export: [{rate: 15}] was configured as a workaround but is shadowed by the wired-but-empty metric_octopus_export, so the plan shows 0 export.
Impact
Any Kraken customer (EDF/E.ON) whose export tariff is discoverable but exposes no fetchable rates cannot use a manual rates_export fallback — export is silently zeroed in the plan.
Proposed fix
Only wire metric_octopus_export once export rate data has actually been fetched (not merely when a tariff code is discovered). When no export rates are available, leave it unwired so fetch.py falls back to the user's manual rates_export.
Summary
The Kraken component wires
metric_octopus_exportintofetch.pywhenever an export tariff is discovered, regardless of whether any export rate data was actually fetched. For tariffs whose rate endpoint returns no data (e.g. EDF SEG export tariffs, which 404 onstandard-unit-rates), this wiresmetric_octopus_exportto an emptyexport_ratessensor. That empty sensor then takes precedence over the user's manualrates_exportfallback, so all export is dropped from the plan and the manual export rate can never take effect.Affected component
apps/predbat/kraken.py—KrakenAPI.run()Root cause
In
run():The wiring is gated only on
self.export_tariff(tariff discovered), not on export rates actually being retrieved. An export tariff can be discovered (registered on the meter point) while the rate endpoint returns nothing.In
fetch.py, export-rate selection is anif/elif/elsechain wheremetric_octopus_exportis checked by key presence:Because the key is present (even pointing at an empty sensor), the
elsebranch that would use the user's manualrates_exportis never reached.Production evidence (EDF SEG customer)
The EDF account has the export tariff
EDF_EXPORT_SEG_12Mregistered (so it's discovered), but Kraken'sstandard-unit-ratesendpoint 404s for it — SEG export tariffs don't publish half-hourly unit rates. A manualrates_export: [{rate: 15}]was configured as a workaround but is shadowed by the wired-but-emptymetric_octopus_export, so the plan shows 0 export.Impact
Any Kraken customer (EDF/E.ON) whose export tariff is discoverable but exposes no fetchable rates cannot use a manual
rates_exportfallback — export is silently zeroed in the plan.Proposed fix
Only wire
metric_octopus_exportonce export rate data has actually been fetched (not merely when a tariff code is discovered). When no export rates are available, leave it unwired sofetch.pyfalls back to the user's manualrates_export.