Home Assistant Integration

We now have the facility to set up a Home Assistant sensor free of charge.

We have previously blocked HomeAssistant as, well, we were being hammered by it with calls every few seconds! However we would like to help the community who just want basic info about the price of heating oil.

To reduce pressure, we may cache results a little. Please try to respect the service as if it is hit too often, we may need to start returning error codes or disable it entirely. There should be no need to call this service more than once an hour, ideally once a day.


API Reference

Get Oil Price

Returns the cheapest and average heating oil price per litre (pence) based on 900-litre quotes.

GET https://www.cheapestoil.co.uk/homeassistant/oilprice

Query Parameters

Parameter Type Description
postcode string optional A Northern Ireland postcode. Either the outcode (BT11) or a full postcode (BT11 1AB) — the inward part is ignored. If omitted, returns prices across all of Northern Ireland. Only BT postcodes are accepted.

Response — 200 OK

{ "cheapest_ppl": 59.23, "average_ppl": 62.45, "postcode": "BT11", "for_litres": 900, "last_updated": "2026-04-19T14:32:00Z" }
FieldTypeDescription
cheapest_ppl number Lowest price per litre in pence, rounded to 2 decimal places.
average_ppl number Mean price per litre across all matching suppliers, rounded to 2 decimal places.
postcode string | null The resolved outcode used to filter results. null when no postcode was supplied.
for_litres number The order quantity the prices are based on. Always 900.
last_updated string (ISO 8601 UTC) The time this data was fetched from the database. Results are cached for up to 1 hour, so this reflects when the cache was last populated, not the current time.

Error Responses

StatusConditionBody
400 Postcode supplied but is not a Northern Ireland (BT) postcode, or cannot be parsed. {"error": "Only Northern Ireland postcodes (BT...) are accepted"}
404 No prices found for the given postcode area. {"error": "No prices found"}

Caching

Responses are cached server-side for 60 minutes. The last_updated field shows when the current cached value was computed.


Home Assistant Configuration

Add one or more rest sensors to your configuration.yaml. Each sensor below polls the endpoint and extracts a single field.

NI-wide prices (no postcode)

sensor: - platform: rest name: Heating Oil Cheapest PPL (NI) unique_id: heating_oil_cheapest_ppl_ni resource: https://www.cheapestoil.co.uk/homeassistant/oilprice value_template: "{{ value_json.cheapest_ppl }}" unit_of_measurement: "p/L" device_class: monetary scan_interval: 3600 - platform: rest name: Heating Oil Average PPL (NI) unique_id: heating_oil_average_ppl_ni resource: https://www.cheapestoil.co.uk/homeassistant/oilprice value_template: "{{ value_json.average_ppl }}" unit_of_measurement: "p/L" device_class: monetary scan_interval: 3600

Postcode-filtered prices

sensor: - platform: rest name: Heating Oil Cheapest PPL (BT11) unique_id: heating_oil_cheapest_ppl_bt11 resource: https://www.cheapestoil.co.uk/homeassistant/oilprice?postcode=BT11 value_template: "{{ value_json.cheapest_ppl }}" unit_of_measurement: "p/L" device_class: monetary scan_interval: 3600

Reading last_updated as a separate sensor

sensor: - platform: rest name: Heating Oil Price Last Updated unique_id: heating_oil_last_updated resource: https://www.cheapestoil.co.uk/homeassistant/oilprice value_template: "{{ value_json.last_updated }}" device_class: timestamp scan_interval: 3600

Tip: Set scan_interval: 3600 (1 hour) to match the server-side cache. Polling more frequently will return the same cached value and add unnecessary load.


Example Requests

cURL — NI-wide

curl https://www.cheapestoil.co.uk/homeassistant/oilprice

cURL — filtered by postcode

curl "https://www.cheapestoil.co.uk/homeassistant/oilprice?postcode=BT11" curl "https://www.cheapestoil.co.uk/homeassistant/oilprice?postcode=BT11%201AB"

PowerShell

Invoke-RestMethod "https://www.cheapestoil.co.uk/homeassistant/oilprice?postcode=BT11"

Live Prices

See the current heating oil prices for Northern Ireland.

View prices

 

Price Trends

Historical heating oil price charts.

View trends

 

Contact Us

Questions or feedback about the API?

Get in touch