halfhour

› how it works

Octopus publishes tomorrow's Agile prices at about 4pm. Halfhour shows those as they are, then forecasts the rest of the next 14 days. You can see what is pushing each forecast up or down.

From weather to price

  1. 1

    Collect

    The last 70 days of half-hourly Agile import and Agile Outgoing prices for all 14 regions come from the Octopus public API. Weather for the same period, and for 16 days ahead, comes from Open-Meteo.

  2. 2

    Fit

    Each region gets its own ridge regression, one model for import and one for export. It's a simple linear model, so every forecast breaks down exactly into the drivers listed below.

  3. 3

    Test

    Before each run, the model is fitted again without the last 14 days, then asked to forecast those days using only the weather forecasts that existed 3 days earlier. The average miss from that test is the number on the prices page.

  4. 4

    Publish

    Published prices always replace the forecast. Your browser also checks Octopus directly every 15 minutes, so new prices appear without waiting for a rebuild.

Does it work?

We tested it on 20 September to 11 October 2026. For every day, the model only had the weather forecast that existed 1, 3 or 5 days before, the same as you would in real life. Then we compared its forecast with what Agile actually charged. Average miss in p/kWh, lower is better:

London (C)North West (G)North Scotland (P)
Halfhour, 1 day ahead5.45.76.5
Halfhour, 3 days ahead5.15.46.1
Halfhour, 5 days ahead5.55.86.6
Average price for that time of day7.47.88.9
Same time last week9.910.411.8
Cheapest 2 hours picked within 3p of the real best18 of 21 days17 of 2116 of 21

So it is clearly better than guessing from the usual daily pattern, and it finds a good cheap window most days. It is not perfect: a typical miss is about a fifth of the average price, and days 6 to 14 haven't been tested this way yet, so treat those as a rough guide. You can run the same test yourself with node scripts/evaluate.mjs.

What the drivers mean

Wind
Wind speed at turbine height over seven wind-fleet areas (Dogger Bank to the Highlands), turned into a capacity factor with a generic power curve, for the half-hour and as a 24-hour average. On windy days less gas is burned, so prices fall.
Cold
Heating degrees below 15.5 °C, averaged across five big cities. Cold raises demand.
Sunshine
Solar radiation at the same cities. Sunny middays pull prices down, more so when it is also windy.
Time of day
The usual daily shape: cheap small hours, morning and evening humps.
4pm-7pm peak
Agile adds a fixed amount between 4pm and 7pm. The model learns how big it is from each region's own prices.
Weekend
Lower weekend demand, including a smaller evening peak.

The model can't see gas prices, interconnector flows, power station outages or changes to Octopus's pricing formula. When one of those shifts, the forecast will be off until there's enough new history to learn from.

JSON feed

The feed is static JSON, rebuilt with each forecast run. Please don't poll more than every 30 minutes. The data only changes when the forecast runs or Octopus publishes.

GET/api/v1/index.json

Lists the regions, when the forecast ran, model scores, and data source status.

GET/api/v1/regions/{code}.json

Prices from local midnight today, 14 days ahead. Each slot looks like this:

{
  "t": 1791867600000,   // slot start, Unix ms (UTC)
  "i": 16.29,           // import p/kWh inc VAT
  "e": 10.21,           // export p/kWh
  "ip": 0, "ep": 0,     // 1 = published by Octopus, 0 = forecast
  "ilo": 7.23, "ihi": 25.36,  // likely import range (forecast only)
  "elo": 6.02, "ehi": 14.4,   // likely export range (forecast only)
  "d": [-11.6, -0.1, 0, -2.3, 0, 0]  // drivers, order in "drivers"
}

Region codes

  • XNational average
  • AEastern England
  • BEast Midlands
  • CLondon
  • DMerseyside & North Wales
  • EWest Midlands
  • FNorth East England
  • GNorth West England
  • HSouthern England
  • JSouth East England
  • KSouth Wales
  • LSouth West England
  • MYorkshire
  • NSouth Scotland
  • PNorth Scotland

Home Assistant card

A dashboard card that shows the cheapest window, the price now and a chart of today and tomorrow. It follows your Home Assistant theme.

  1. Go to Settings, then Dashboards, then the three dots, then Resources. Add https://halfhour.uk/ha/halfhour-card.js as a JavaScript module.
  2. Edit a dashboard, add a card and search for "Halfhour", or paste the YAML below.
type: custom:halfhour-card
region: C            # A to P, or X for the national average
window: 2            # hours you want to run something for
show_export: false   # also show the best Agile Outgoing window
tariff: current      # or "2018" for the original Agile

Home Assistant sensor

A REST sensor gets the current price and keeps the full slot list as an attribute for charts or automations. Replace C with your region code from the list above.

rest:
  - resource: https://halfhour.uk/api/v1/regions/C.json
    scan_interval: 1800
    sensor:
      - name: Halfhour forecast
        unique_id: halfhour_forecast_c
        unit_of_measurement: p/kWh
        value_template: >-
          {% set now_ms = (now().timestamp() // 1800 * 1800 * 1000) | int %}
          {{ (value_json.slots | selectattr('t', 'eq', now_ms) | first).i }}
        json_attributes:
          - slots
          - generatedAt

Who made this

Halfhour is a side project by Aydan. It is a small, independent site, not a company product, and it isn't connected to Octopus Energy or to any other Agile price site.

The forecast isn't AI. It's a plain statistical model (a ridge regression, the same family as a line of best fit) that weighs up wind, temperature, sunshine and the time of day. Every forecast can be broken down into those parts, which is what the "explain" panel on the prices page shows.

Sources and terms

  • Octopus Energy public API: products AGILE-24-10-01 (import) and AGILE-OUTGOING-19-05-13 (export).
  • Open-Meteo: hourly wind at 100 m, temperature and solar radiation (CC BY 4.0).
  • Prices are pence per kWh including VAT, in UK time.
  • Forecasts are estimates and can be wrong. There's no warranty, so don't use this as your only guide for money or safety decisions.
  • Halfhour is independent. It isn't run by or connected to Octopus Energy or any other Agile price site.