Skip to content

Latest commit

 

History

History
258 lines (243 loc) · 9.39 KB

README.md

File metadata and controls

258 lines (243 loc) · 9.39 KB

Module: Nexus Metro RTI

The MMM-NexusMetroRTI module is compatible with the MagicMirror² (Github Repository) project and can display live estimates of train arrival times at stations along the Nexus Tyne and Wear Metro, located in the North-East of the UK. It utilises their own undocumented API.

Examples

Full Full

Requirements and Optional Dependencies

This module utilises a public API which requires no API key. Should this change in the future please report the issue within the Github repository.

You will need to configure the station and platform by using the station codes which listed ./public/cache/stations.json and platform numbers in ./public/cache/platforms.json.

NOTE: These files are used by the module to reduce API calls since the station information is rarely changed. You can update the cached information by setting the config property updateCacheOnStart: true.

Calvert Font

As displayed in the example above, the module can use the Calvert font as is used in branding on the Tyne and Wear Metro. Because of licencing, the font is not included in the repository. This font is available to be licensed by Monotype here, or otherwise available online from sources like here. If you would like to use the font, obtain a copy and save it in ./public/fonts/ with the filename Calvert-MT and extension either ttf, woff, or woff2.

Using the module

To use this module, add it to the modules array in the config/config.js file: As can be seen, to show multiple station platforms simply place another module and hide the station title. The margin between modules will automatically collapse.

modules: [
	{
		module: 'MMM-NexusMetroRTI',
		position: 'top_right',
		config: {
			station: 'MTW',
            platform: 3,
		}
	}
    {
		module: 'MMM-NexusMetroRTI',
		position: 'top_right',
		config: {
            showStation: false,
			station: 'MTW',
            platform: 4,
		}
	}
]

Configuration options

The following properties can be configured:

Option Description
updateCacheOnStart
Updates cached station and platform data on module load.

(Values: true, false)
(Default: false)
colorize
Whether or not to color train list items by their line, Green or Yellow, and the metro logo.

(Values: true, false)
(Default: true)
showStation Whether or not to show the station title and metro logo above the list of trains.

(Values: true, false)
(Default: true)
showPlatform Whether or not to show the platform title above the list of trains.

(Values: true, false)
(Default: true)
showDestination Whether or not to show the terminus of each train.

(Values: true, false)
(Default: true)
showLocation Whether or not to show the last known location of the train reported by the API.

(Values: true, false)
(Default: true)
showDueIn Whether or not to show the estimated arival time of the train.

(Values: true, false)
(Default: true)
platformFormat Format of the platform title. Accepts a nunjucks template string. Available variables are {{platformNumber}} and {{helperText}}, which shows the direction of the platform as it would be anounced or displayed in a station. You could also just manually set this to some string you liked.

(Example: "Platform {{platformNumber}}" displays "Platform 1")
(Default: "{{helperText}}")
locationFormat Format of the location string. Accepts a nunjucks template string. Available variables are:
  • {{eventStation}} - Last station name
  • {{eventPlatform}} - Last station platform
  • {{event}} - Last event code (One of: "DEPARTING", "APPROACHING", "ARRIVED", "READY_TO_START")
  • {{eventTypeString}} - Human friendly format of the above. (One of: "Departed from", "Approaching", "Arrived at", "Starting at")
  • {{trainNumber}} - Identifier of the train
  • {{eventTime}} - Human friendly string of the timestamp of the event. See the property {{locationTimeFormat}} for how to format this.
  • {{destination}} - Terminal station
  • {{dueIn}} - Time in minutes before
  • {{line}} - Line code (One of: "GREEN" "YELLOW")
Example: "{{eventTypeString}} {{eventStation}} at {{eventTime}}" displays "Departed from Sunderland at 12:01"
Default Value: "{{eventTypeString}} {{eventStation}}"
locationTimeFormat moment.JS time format.

(Values: Any moment.js format string)
(Default: "HH:mm")
minETA Minumum value of ETA for a train to show. Set to -1 to show all trains. Corresponding values are: -1 = Arrived and 0 = Due,

(Values: [-1 to ...])
(Default: -1)
maxETA Maximum value of ETA for a train to show. Set to -2 to show all trains.

(Values: [-2 to ...])
(Default: -2)
maxTrains Limit on the number of trains to display. Note that the API only returns a maximum of 4 trains currently.

(Values: [1 to 4])
(Default: 4)