MagicMirror² module to show Dutch train information
JavaScript CSS
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

NS Trains - MagicMirror² module

Build Status

This is a module for MagicMirror². Shows informantion on trains departuring a configurable Dutch trainstation.

Example Visualization Example Visualization with destination

Installing the module

To install the module, just clone this repository to your modules folder: git clone nstreinen. Then run cd nstreinen and npm install to install the dependencies.

Using the module

You will need a username and password for the NS-API. These can be requested at

To use this module, add it to the modules array in the config/config.js file:

modules: [
    module: 'nstreinen',
    position: 'top_right',
    header: 'Treinen vanaf Schiphol Airport',
    config: {
      pass: '<NS-API-password>',
      station: 'Schiphol Airport'

Configuration options

The following properties can be configured:

Option Description
user Your API username. Most likely in the form of an e-mailaddress.
Request your credentials at NS API
pass Your API password.
station The station to show trains for.
destination The destination to show trains for. If this is configured the trains and required transfers from station to this destination will be shown.
maxEntries Maximum number of trains to show per station.
Default value: 5
reloadInterval Number of milliseconds between refresh.
Keep in mind there is a maximum of 50.000 requests per day for the API.
Default value: 5 * 60 * 1000 (5 minutes)
displaySymbol Defines wether or not to show a symbol for each line.
Possible values: true or false.
Default value: true
symbolMapping Maps the train types to the symbol to show.
If the train type is not found, the symbol for default is used.
Possible symbols: See Font Awesome website.
Default value: See Default symbolMapping.
fade Fade the trains listed to black. (Gradient)
Possible values: true or false
Default value: true
fadePoint Where to start fade?
Possible values: 0 (top of the list) - 1 (bottom of list)
Default value: 0.25

Default symbolMapping

symbolMapping: {
  'Intercity': 'train',
  'Intercity direct': 'forward',
  'Sprinter': 'stop-circle',
  'Stopbus i.p.v. trein': 'bus',
  'Snelbus i.p.v. trein': 'bus',
  'default': 'train'