Skip to content

New Share your ideas with the AWTRIX community. Keep your creations together in your account.

Sign in

Which AWTRIX do you have? Choose it once and the Hub shows what runs on it.

ScriptAWTRIX NG

Fuel Prices

On an AWTRIX display
Fuel Prices shown on an AWTRIX display
Fuel Prices · by .hank_the_tank

On your display

Shows the cheapest nearby fuel price (Tankerkoenig.de)

Which AWTRIX do you have? See below where it runs, or choose your device.
Topic
Miscellaneous
Includes
Script · 1 icon

Runs on

  • Runs on 32×8 (TC001 & DIY)
  • Runs on 52×16 (TC002)
  • Does not run on 32×8 with AWTRIX 3 (TC001 & DIY) Made for AWTRIX NG.

Choose your display in the next step.

Send to AWTRIX

Choose your AWTRIX

Fuel PricesAWTRIX NG script

Install this script on your AWTRIX NG. Its icons and sounds are installed with it.

Your AWTRIX’s local address, for example 192.168.178.39 or awtrix.local.

The name shown in your AWTRIX script list. Use letters, digits, hyphens or underscores.

Connection & device login

Connect your phone or computer to the same network as your AWTRIX. Allow local network access if your browser asks.

Use the device’s IP address, without a page path such as /#/apps.

If your AWTRIX requires a login, the username and password fields will appear when you connect.

Sign in to the Hub to install scripts. Attached files are installed separately.

Script description

Fuel Prices — AWTRIX NG App

Shows the cheapest nearby fuel price for one fuel type of your choice — Diesel, E5 or E10 —
together with the brand and street of that station, live from the free
tankerkoenig.de API.

type version

What it shows

One scrolling line, right when the app comes up in your rotation:

2.299€ | ARAL | Brunnenstraße

The price is shown in green (configurable), the brand and street in white. A small pump icon
sits to the left of the text — either one you supply yourself, or a simple built-in fallback
shape if none is set or an icon fails to load.

Requirements

  • An AWTRIX NG device (32×8 LED matrix) with network access.
  • A free API key from creativecommons.tankerkoenig.de.
    Registration is free; after signing up you may need to complete a short follow-up
    confirmation step before the key becomes active.
  • Your own approximate coordinates (latitude/longitude), e.g. from
    latlong.net or any map app.

Installation

  1. Open your AWTRIX web interface — its IP address, or http://awtrixng-xxxxxx.local.
  2. Go to the Scripts tab and create a new script, e.g. named FuelPrices.
  3. Paste in the code below and press Save.
  4. The app joins the rotation shortly after. Press the right button on the device to jump
    straight to it.
  5. Open Apps → the ⋯ menu on the FuelPrices row → Settings, and fill in your API
    key and coordinates (see the table below). Saving restarts the app.

Settings

Setting Type Default Notes
API key text YOUR-API-KEY Paste your tankerkoenig.de key here — never share it publicly.
Latitude / Longitude text Berlin (52.5200 / 13.4050) Use a dot as the decimal separator, e.g. 48.1374.
Radius number, 1–25 km 5 km Search radius; the tankerkoenig API caps this at 25 km.
Fuel select Diesel Diesel, E5 or E10 — one fuel type per app instance.
Refresh number, 5–60 min 10 min How often prices are re-fetched. tankerkoenig prices themselves only update every 4–5 minutes, and the API asks that automated clients not poll faster than every 5 minutes.
Price color color Green (#00FF00) Colour of the price segment; brand/street are always white.
Icon ID text (empty) Optional 8×8 icon ID already installed on your device. Leave empty for a drawn placeholder pump icon.

To show more than one fuel type, install the script again under a different name and pick a
different fuel in its own settings — each installed copy keeps its own settings and state.

How it works (short version)

  • Queries list.php sorted by price for the selected fuel type, so the first station in the
    response is always the cheapest match in range.
  • Uses the device's find/keep HTTP option to pull only a small window of the response
    (the first station's record) instead of the whole reply, to stay light on the shared script
    memory.
  • Refetches on a timer in the background (loop()), so the panel always has something to
    show the moment it's this app's turn — never a blank screen.
  • Pressing the middle/select button while the app is showing forces an immediate refresh.

Notes & limitations

  • Needs a valid, activated API key — an invalid or not-yet-active key fails silently on the
    panel (keeps showing ...), but logs a line under Log in the AWTRIX web UI so you can
    tell it apart from a real "no stations found" case.
  • Shows the single cheapest station in range for the chosen fuel — not a list of several
    stations.
  • Respect tankerkoenig's fair-use terms: don't set the refresh interval below 5 minutes, and
    don't share your personal API key.

More scripts in Miscellaneous

Something wrong with this script? Report it.