NSW Fuel Prices (unofficial) smart home integration, free and open source

Unofficial. Fuel prices in New South Wales and Tasmania from NSW FuelCheck.
Fuel prices of New South Wales (and Tasmania) in Gladys: the prices of the stations you follow, and the cheapest price of each fuel type around a point. Read from NSW FuelCheck with the Fuel API of API.NSW.
Source: NSW FuelCheck, NSW Government (Department of Customer Service), via the Fuel API of API.NSW. This integration is not affiliated with nor endorsed by the NSW Government. Prices are as the stations report them: check the price at the pump.
This integration was never tested with a real key: it follows the API.NSW documentation, and its tests play a scripted Fuel API.
What you need
A free API.NSW account: sign up on https://api.nsw.gov.au, create an app, subscribe it to the Fuel API (free plan) and copy its API key and API secret. Both are kept by Gladys in its database, never shown again, and sent only to api.onegov.nsw.gov.au.
Station codes: find a station on https://www.fuelcheck.nsw.gov.au; its code is the FuelCheck station code. A
Tasmanian station is written TAS:code and needs the "New South Wales and Tasmania" region.
Configuration
| Field | Meaning |
|---|---|
| API key, API secret | Of your API.NSW app subscribed to the Fuel API (required). |
| Region | New South Wales only (default), or New South Wales and Tasmania. |
| Fuel types | FuelCheck codes, 6 at most: E10, U91, P95, P98, DL, PDL, E85, B20, LPG... Empty: E10, U91, DL. |
| Stations followed | Station codes, 10 at most; each becomes a device with one price per fuel type. |
| Read interval | 1 to 24 hours (1 by default). |
| Cheapest nearby | Latitude, longitude and radius (1 to 50 km, 5 by default) of a circle; optional. |
Devices
- One device per station followed (named after FuelCheck once read): one price per fuel type, in Australian dollars per litre (1.899 for 189.9 c/L). A price older than 30 days, absurd or without a time is not published: unknown, never 0.
- Cheapest fuel nearby (when a circle is set): for each fuel type, the lowest price updated within 7 days inside the circle, and the station that has it (brand, name, address, distance). On a tie, the nearest station.
A value is published when the station changed its price or confirmed it again (new FuelCheck time).
Quota: 2 500 calls a month
The free plan allows 2 500 calls a month, the token call included. The integration:
- reads all prices in one call per interval, whatever the number of stations, once per hour at most (one more try in the same round only when a token kept from before is refused); the token (about 12 hours) is reused, so about 800 calls a month at 1 hour;
- counts its calls in
/data, per Sydney calendar month, before each call leaves, and stops at 2 300 until the first day of the next month (a margin for other uses of the same key, which it cannot see); - never reads sooner (while
/datacan be written; the status says otherwise) after a restart, a reconnection, a saved configuration (the prices read within 2 hours are used again without a call) or a press on the test button; - pauses every call after a 429 (Retry-After respected), a 5xx or another unexpected answer: 15 or 30 minutes, doubled each time, at most 6 hours.
Refused key
When API.NSW refuses the key or secret (invalid_client at the token), nothing more is sent: the status says so and
the integration waits for new credentials, or for a press on Show the last read / try the key again (one try per
press). A token refused on the prices call is not a refusal of the key: one new token and one more try, then a pause.
Status and test button
The status gives the time of the last read, the stations not found or without a current price, the calls counted this month and the next read. The test button shows the same; it calls the API only to try refused credentials.
Privacy
The key, the secret and the token never appear in logs, the status or /data. The center of the circle is never
logged. /data keeps the time of the last read, the call count, a pause, the station names and what was published;
a refused key is kept as two 8-bit salted fingerprints only.
Configuration settings
These are the settings NSW Fuel Prices (unofficial) asks for in its configuration screen in Gladys.
| Setting | Type | Required | Description |
|---|---|---|---|
| NSW FuelCheck fuel prices | section | No | Prices of the stations you follow and the cheapest price around a point, read from the Fuel API of API.NSW (NSW FuelCheck) with a free key and secret. The free plan allows 2 500 calls a month: this integration reads all prices in one call per interval (1 hour at least), counts its calls and stops at 2 300 until the next month. Source: NSW FuelCheck, NSW Government. Not affiliated with nor endorsed by the NSW Government; prices as reported by the stations, check the price at the pump. |
| API key | secret | Yes | The API key of your API.NSW app subscribed to the Fuel API. Kept by Gladys in its database, never shown again, sent only to api.onegov.nsw.gov.au. |
| API secret | secret | Yes | The API secret of the same app. Kept by Gladys in its database, never shown again, sent only to api.onegov.nsw.gov.au. |
| Region | select | No | New South Wales only (smaller answer), or New South Wales and Tasmania (needed for a Tasmanian station). One call either way. |
| Fuel types | string | No | FuelCheck fuel codes, separated by commas, 6 at most: E10, U91, P95, P98, DL, PDL, E85, B20, LPG... Empty: E10, U91, DL. |
| Stations followed | string | No | FuelCheck station codes, separated by commas, 10 at most; a Tasmanian station is written TAS:code. Each one becomes a device with one price per fuel type. |
| Read interval (hours) | number | No | From 1 to 24 hours. One call per read, plus a token about twice a day: about 800 calls a month at 1 hour. |
| Language | select | No | Language of the device and feature names. |
| Cheapest nearby (optional) | section | No | A circle around a point: for each fuel type, the lowest price updated within 7 days and the station that has it, on one device. Leave the latitude and longitude empty to turn it off. |
| Latitude | number | No | Center of the circle (decimal degrees, negative: south). |
| Longitude | number | No | Center of the circle (decimal degrees). |
| Radius (km) | number | No | From 1 to 50 km. |
How to install NSW Fuel Prices (unofficial) in Gladys
- In Gladys, open Integrations: NSW Fuel Prices (unofficial) appears in the catalog, next to the native integrations, with a community badge.
- Click Install. Gladys pulls the Docker image (
ghcr.io/lm1lc3n7/gladys-nsw-fuel-prices:0.1.1), starts it in a sandbox isolated from the core, and generates the integration's interface (devices, discovery and configuration). - Open the Configuration screen of the integration, fill in the settings, and save.
- You can also install it directly from its repository URL: https://github.com/LM1LC3N7/gladys-nsw-fuel-prices.
NSW Fuel Prices (unofficial) requires Gladys >=5.3.0. The catalog inside Gladys refreshes every hour, so a new version becomes available at most one hour after its release.
Not running Gladys yet? It is free and open source: follow the installation guide to get started.
About external integrations
NSW Fuel Prices (unofficial) is an external integration: a community integration packaged as a Docker container and published on GitHub, that Gladys installs in one click and runs in a sandbox isolated from its core. It is published and maintained by LM1LC3N7, not by the Gladys core team.
- Browse all integrations, native and community
- Build and publish your own external integration
- Source code on GitHub — source of this documentation