Skip to content
Trafikverket Train Timetable as MagicMirror² Module
JavaScript Shell CSS
Branch: master
Clone or download
Per Garden
Latest commit 93551b4 Feb 7, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
templates 1.2.0 version from… Mar 23, 2018
translations 1.2.0 version from… Mar 23, 2018
.eslintrc.json base template module Feb 10, 2017
.stylelintrc base template module Feb 10, 2017
.travis.yml 1.2.0 version from… Mar 23, 2018 Template history no longer relvant. Should have created from scratch,… Mar 27, 2018
Gruntfile.js 1.2.0 version from… Mar 23, 2018
LICENSE Passing npm test Mar 23, 2018
MMM-Trains-Trafikverket.css Styling and alignment Mar 26, 2018
MMM-Trains-Trafikverket.js Small formatting fix Feb 7, 2019 New config options. Jan 11, 2019
node_helper.js 1.2.0 version from… Mar 23, 2018
package-lock.json Starting MMM-Trains-Trafikverket Mar 23, 2018
package.json Correct package info in package.json Mar 27, 2018
screenshot.png Screenshot Mar 27, 2018
station.js Corrected some missing tabs in formatting Mar 23, 2018


Additional Module for MagicMirror², to display train departure times for railway stations within Sweden, as supplied by the Swedish Transport Administration (Trafikverket).

Using this module requires registration with Trafikverket/Trafiklab see section Base API.

Alt text


  1. Navigate into your MagicMirros's modules folder.
  2. Clone repository git clone
cd MMM-Trains-Trafikverket && npm install

Run the test npm script

npm test


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

modules: [
      module: "MMM-Trains-Trafikverket",
      position: "bottom_right",
      header: "Avgångar Malmö C",
      config: {
        key: "API-key", // Required
        // Station name for which to continously fetch departure data
        name: "Malmö C", // Required
        // Max number of departures to show at once
        count: 5, // Optional
        // Retry while loading data in ms
        retryDelay: 5 * 1000, // Optional
        // Display update interval in ms
        updateInterval:  2 * 60 * 1000, // Optional
        // Hours to look ahead
        hoursAhead: 15, // Optional
        // Max number of lines in list
        maxItems: 5, // Optional


Name must be the exact official(?) Trafikverket string. Valid names can be tried out downloading and running

API-key as described below. Defaults for optional fields as in example above.

Base API

This module uses the Swedish Transport Administration open API, Trafikverket öppet API. A valid API-key is required:

  • Register with Trafikverket/Trafiklab:
  • Log in at:
  • Get a free API-key:
  • Set up a Trafiklab project:
  • Choose Trafikverket öppet API as project API to use:
You can’t perform that action at this time.