Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Magic Mirror Module for UK rail information. Returns departure info about a SPECIFIED UK rail station.

License

NotificationsYou must be signed in to change notification settings

nwootton/MMM-UKNationalRail

Repository files navigation

Additional Module for MagicMirror²https://github.com/MichMich/MagicMirror

Please note - I no longer run a MagicMirror, so this module is no-longer supported. Feel free to fork and update as necessary.

Module: UKNationalRail

This module displays LIVE train departures from the specified station(s).

Using the module

Git clone from this repository into the modules sub-directory of the Magic Mirror installation, change directory into the newly cloned code and then run npm install.

git clone https://github.com/nwootton/MMM-UKNationalRail.gitcd MMM-UKNationalRailnpm install

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

modules:[{module:'MMM-UKNationalRail',position:'bottom_left',header:'Departures',//Optional - delete this line to turn OFF the header completelyconfig:{stationCode:'SUR',// CRS code for stationapp_id:'',// TransportAPI App IDapp_key:'',// TransportAPI App KeymaxResults:5,//Optional - Maximum results to display.showOrigin:false//Optional - Show the origin of the train in the table}},]

There are 3 MANDATORY fields -stationCode,app_id andapp_key. All the others are used to limit the amount of info you get back, especially useful for busy stations like Clapham Junction.

Add a config for each station you require info on

PLEASE NOTE The TransportAPI provides a sample key in their documentation that I previously referenced here. This is being removed very soon, so youMUST register to get this module to work!

The following is taken from the TransportAPI documentationhere

OptionRequired Settings Description
stationCodeString. The station you require information about.
This defaults to using the CRS format, but you can also specify the tiploc format by preceeding the code with 'tiploc:'

This value isREQUIRED
Example: SUR
Example: tiploc:GUILDFD
api_idString. Your TransportAPI app_idGet yours here.

This value isREQUIRED
Example: 03zf7118
app_keyString. Your TransportAPI app_keyGet yours here.

This value isREQUIRED
Example: z9307fd87b0000c107e098d5effedc97
OptionOptional Settings Description
called_atString. Only include services that call at the given station, before calling at the station of interest.
It appears that you can't mixcalled_at withcalling_at as it returns an empty response.

Example: 'THD'
calling_atString. Only include services that call at the given station, after calling at the station of interest.
It appears that you can't mixcalling_at withcalled_at as it returns an empty response.

Example: 'EAD'
darwinBoolean. Additionally use data from the National Rail Enquiries Darwin Data Feeds when determining the value of the status fields for all the departures, arrivals or passes.

Default: false
destinationString. Only include services terminating at the given station.

Example: 'WAT'
from_offsetString. Modifies the start of the time window for which services are retrieved. By default, this is one hour in the past relative to the date/time of interest..

Default: '-PT01:00:00'
operatorString. Only include services that are operated by the given operator, specified using its ATOC code

Example: 'SW'
originString. Only include services originating from the given station.

Example: 'HMC'
serviceString. Only include services that have the given service code.

Example: '24673205'
to_offsetString. Modifies the end of the time window for which services are retrieved. By default, this is two hours in the future relative to the date/time of interest.

Default: 'PT02:00:00'
train_statusString. Only include services having the specified train status. Can be used to show either 'passenger' or 'freight' services.

Default: 'passenger'
typeString. Only include services of the given type. Allowed types are "arrival", "departure" or "pass".
These individual values can be combined using a comma separated list of the allowed types such as:
"arrival,departure,pass" or "pass,departure".

Default: 'departure'
OptionOther Settings
maxResultsInteger. Limits the number of rows returned by the module. This will be the highest number between this value or the number of rows returned if it is less.

Default: 5
showOriginBoolean. This shows the origin of the train in the results grid.

Default: false
showPlatformBoolean. This shows the platform number of the train in the results grid. If no platform is specified it will show '-'

Default: true

To find the CRS Station codes for the 'stations of interest' go here:http://www.railwaycodes.org.uk/crs/CRS0.shtm or use OpenStreetMap. Information on using OpenStreetMap is found inthe CRS.md file in this repo

Transport API

To setup an account for the App_id & app_key sign up for an account here:http://www.transportapi.com/

Troubleshooting

If there are issue getting data out of the module I'm ALWAYS going to ask the following:

  1. Do you have an account set up at Transportapi.com?
  2. Do you have an app_id and app_key set up?
  3. Do you know the CRS code for the station?
  4. If you use the live api documentationhere and put in the info you want to use does it respond without an error?
  5. Is the info in your config the same as that you’ve used successfully in the live api docs?
  6. Include the Station CRS code in the report - each operator supplies information slightly differently. While TransportAPI does catch most of these, I might not have.

About

Magic Mirror Module for UK rail information. Returns departure info about a SPECIFIED UK rail station.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp