Zum Hauptinhalt springen

NSW Fuel Prices (unofficial) Smart-Home-Integration, kostenlos und Open Source

NSW Fuel Prices (unofficial)-Integration für Gladys Assistant

Unofficial. Fuel prices in New South Wales and Tasmania from NSW FuelCheck.

Info

Die Dokumentation dieser Integration wird von ihrem Autor geschrieben und ist bisher nur auf Englisch verfügbar.

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​

FieldMeaning
API key, API secretOf your API.NSW app subscribed to the Fuel API (required).
RegionNew South Wales only (default), or New South Wales and Tasmania.
Fuel typesFuelCheck codes, 6 at most: E10, U91, P95, P98, DL, PDL, E85, B20, LPG... Empty: E10, U91, DL.
Stations followedStation codes, 10 at most; each becomes a device with one price per fuel type.
Read interval1 to 24 hours (1 by default).
Cheapest nearbyLatitude, 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 /data can 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.

Konfigurationseinstellungen​

Diese Einstellungen fragt NSW Fuel Prices (unofficial) in seinem Konfigurationsbildschirm in Gladys ab.

EinstellungTypPflichtfeldBeschreibung
NSW FuelCheck fuel pricessectionNeinPrices 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 keysecretJaThe 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 secretsecretJaThe API secret of the same app. Kept by Gladys in its database, never shown again, sent only to api.onegov.nsw.gov.au.
RegionselectNeinNew South Wales only (smaller answer), or New South Wales and Tasmania (needed for a Tasmanian station). One call either way.
Fuel typesstringNeinFuelCheck fuel codes, separated by commas, 6 at most: E10, U91, P95, P98, DL, PDL, E85, B20, LPG... Empty: E10, U91, DL.
Stations followedstringNeinFuelCheck 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)numberNeinFrom 1 to 24 hours. One call per read, plus a token about twice a day: about 800 calls a month at 1 hour.
LanguageselectNeinLanguage of the device and feature names.
Cheapest nearby (optional)sectionNeinA 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.
LatitudenumberNeinCenter of the circle (decimal degrees, negative: south).
LongitudenumberNeinCenter of the circle (decimal degrees).
Radius (km)numberNeinFrom 1 to 50 km.

So installierst du NSW Fuel Prices (unofficial) in Gladys​

  1. Öffne in Gladys Integrationen: NSW Fuel Prices (unofficial) erscheint im Katalog neben den nativen Integrationen, mit einem Community-Badge.
  2. Klicke auf Installieren. Gladys lädt das Docker-Image (ghcr.io/lm1lc3n7/gladys-nsw-fuel-prices:0.1.1) herunter, startet es in einer vom Kern isolierten Sandbox und erzeugt die Oberfläche der Integration (Geräte, Erkennung und Konfiguration).
  3. Öffne den Bildschirm Konfiguration der Integration, fülle die Einstellungen aus und speichere.
  4. Du kannst sie auch direkt über die URL ihres Repositorys installieren: https://github.com/LM1LC3N7/gladys-nsw-fuel-prices.

NSW Fuel Prices (unofficial) benötigt Gladys >=5.3.0. Der Katalog in Gladys wird stündlich aktualisiert, eine neue Version ist also spätestens eine Stunde nach ihrer Veröffentlichung verfügbar.

Du nutzt Gladys noch nicht? Es ist kostenlos und Open Source: folge der Installationsanleitung, um loszulegen.

Über externe Integrationen​

NSW Fuel Prices (unofficial) ist eine externe Integration: eine Community-Integration, die als Docker-Container verpackt und auf GitHub veröffentlicht wird. Gladys installiert sie mit einem Klick und führt sie in einer vom Kern isolierten Sandbox aus. Sie wird von LM1LC3N7 veröffentlicht und gepflegt, nicht vom Gladys-Kernteam.

Abonniere den Newsletter von Gladys Assistant

Ein paar E-Mails im Monat zu neuen Releases und Neuigkeiten aus dem Projekt. Verschickt von Pierre-Gilles Leymarie, dem Gründer des Projekts. Jederzeit abbestellbar 🙂