Skip to content

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

ScriptAWTRIX NG

NS Departures

On an AWTRIX display
NS Departures shown on an AWTRIX display
NS Departures · by Emile

On your display

Shows actual departure time, delay, platform and final destination for trains in The Netherlands

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

Runs on

  • Does not run on 32×8 (TC001 & DIY) Made for 52×16 (TC002).
  • 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

NS DeparturesAWTRIX 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

NS-Vertrektijden

Shows the next Dutch Railways (NS) trains on the full 52 × 16 display of the Ulanzi TC002, styled like the departure board on a Dutch platform. After a short yellow NS splash with your station name, every destination you set up gets its own screen: departure time, delay, platform and final destination. Up to three time slots let you show a different station and different destinations in the morning, in the evening or at the weekend.

Features

  • Platform-display look – dark blue background, white time, white platform box on the right and the train's final destination on the second line.
  • Delays at a glance – a red +4 badge next to the time. The departure time stays the planned time, just like on the platform.
  • Platform changes – the platform number turns red when the train leaves from another track than planned.
  • Cancelled trains – the time turns red and an orange VERVALT label replaces the platform box.
  • Train type – IC or SPR is shown when the train is on time and on its planned platform.
  • One screen per destination – up to five destinations per time slot. Enter the same destination twice to see the next train and the one after it.
  • Sorted by real departure time – including delays, so the first screen is always the first train you can take.
  • Walking time – trains you cannot reach in time are skipped.
  • Three time slots – each with its own start station, splash name, walking time, days and destinations.
  • Smooth animation – a light glow over the splash, a quick slide-up between screens and long station names that scroll and loop.
  • Plays nicely with the rotation – the app asks the clock for exactly the time it needs for one round, then the clock moves on to the next app.

Screens

  1. Splash – the NS logo on yellow with the station name of the active slot (2 seconds, with a light glow).
  2. Trains – one screen per destination, in order of actual departure time:
    • on time: 15:52 IC [5]
    • delayed: 15:58 [+4] [18]
    • platform changed: 16:04 [7] (number in red)
    • cancelled: 16:22 [VERVALT] (time in red)

The on-screen word VERVALT is Dutch for "cancelled", as on the real platform display.

Requirements

  • Ulanzi TC002 running AWTRIX NG – the layout is designed for the 52 × 16 display.
  • An NS API key – from an account on the NS API portal (see Setup).
  • Internet access on the clock – the departures are fetched straight from the NS API, no MQTT, Home Assistant or Node-RED needed.
  • Time on the clock – the time slots, the days and the walking time need the clock to know the time.

Settings

Settings are grouped in the web interface: System and Slot 1, Slot 2, Slot 3.

System

Setting Default Description
apikey – Your NS API key (Primary key of the product Ns-App)
interval 60 Seconds between two refreshes of the departures (30–600)
seconds 4 Seconds each train screen is shown (2–20)
debug off Also shows destinations without a train (--:--) and then a list of every departure read; a green dot marks the ones that match

Slot 1, Slot 2, Slot 3

Each slot has the same settings (s1_…, s2_…, s3_…). A slot without a station code is off. Slot 1 is filled in with an example; slots 2 and 3 are empty.

Setting Default (slot 1) Description
sN_from 00:00 Start of the slot (HH:MM)
sN_until 23:59 End of the slot (HH:MM); may run past midnight, e.g. 22:00 to 01:00
sN_st UT NS station code of the start station, e.g. UT (Utrecht Centraal), ASD (Amsterdam Centraal), GN (Groningen). Empty = slot off
sN_name Utrecht Name on the splash; a name with a space is split over two lines (e.g. Utrecht Centraal)
sN_walk 0 Walking time to the platform in minutes; trains leaving sooner are skipped
sN_days empty Days on which the slot is active, in Dutch (see below). Empty = every day
sN_to1 … sN_to5 Groningen, empty… Destination names, one screen each

Days use the Dutch abbreviations ma di wo do vr za zo (Monday to Sunday). Separate with commas and use a dash for a range: ma-vr (weekdays), za,zo (weekend), ma,wo,za-zo. A slot that runs past midnight counts for the day it started. An invalid value is shown on the clock, e.g. SLOT 1: XX, with an example of a valid value below it.

Destinations match the final destination of the train or a station on its route, so Amersfoort also finds a train to Enschede that stops in Amersfoort. Write the name as NS does (Amsterdam Centraal, Driebergen-Zeist); the start of the name is enough.

Time slots should not overlap. If they do, Slot 1 wins over Slot 2, and Slot 2 over Slot 3.

Setup

  1. Create an account on apiportal.ns.nl, subscribe to the product Ns-App (it contains the Reisinformatie API) and copy the Primary key from Profile → Subscriptions.
  2. Open the AWTRIX NG web interface of your TC002.
  3. Go to Scripts and create a new script.
  4. Paste the code and save it.
  5. Fill in the settings: at least the API key in System, and a station code and one destination in Slot 1.
  6. The trains appear on the next turn of the app.

Notes

  • Messages on the screen: NO API KEY (setting empty), NO CONNECTION (no internet or timeout), NS API 401 (key wrong or not subscribed to Ns-App) and NO TRAIN (no matching train in the list).
  • The app reads the next 50 departures from the start station. A destination with few trains (once an hour) may not be in that list yet; debug mode shows how far the list reaches (T/M 16:39).
  • Outside all time slots the app has nothing to show and the screen stays dark during its turn.
  • The time shown is the planned departure time; the delay badge gives the minutes on top of it. The order of the screens uses the actual time.
  • NS sometimes abbreviates station names on the route (Driebergen-Z.); these still match the full name you enter.
  • Keep your API key to yourself: do not include it when you share your settings or a screenshot of them.

More scripts in Miscellaneous

Something wrong with this script? Report it.