GithubHelp home page GithubHelp logo

tobytobias / mmm-uknationalrail Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nwootton/mmm-uknationalrail

0.0 1.0 0.0 244 KB

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

License: MIT License

JavaScript 93.23% CSS 6.77%

mmm-uknationalrail's Introduction

MMM-UKNationalRail

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

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.git
cd MMM-UKNationalRail
npm install

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

modules: [
    {
		module: 		'MMM-UKNationalRail',
		position: 		'bottom_left',
		header:			'Departures',		//Optional - delete this line to turn OFF the header completely
		config: {
			stationCode: 		'SUR', 		// CRS code for station
			app_id: 			'', 		// TransportAPI App ID
			app_key: 			'', 		// TransportAPI App Key
			maxResults: 		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 and app_key. All the others are used to limit the amount of info you get back, especially useful for busy stations like Clapham Junction.

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

The following is taken from the TransportAPI documentation here

Option Required Settings Description
stationCode String. 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 is REQUIRED
Example: SUR
Example: tiploc:GUILDFD
api_id String. Your TransportAPI app_id Get yours here.

This value is REQUIRED
Example: 03zf7118
app_key String. Your TransportAPI app_key Get yours here.

This value is REQUIRED
Example: z9307fd87b0000c107e098d5effedc97
Option Optional Settings Description
called_at String. Only include services that call at the given station, before calling at the station of interest.

Example: 'VXH'
calling_at String. Only include services that call at the given station, after calling at the station of interest.

Example: 'CLJ'
darwin Boolean. 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
destination String. Only include services terminating at the given station.

Example: 'SUR'
from_offset String. 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'
operator String. Only include services that are operated by the given operator, specified using its ATOC code

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

Example: 'WAT'
service String. Only include services that have the given service code.

Example: '24673205'
to_offset String. 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_status String. Only include services having the specified train status. Can be used to show either 'passenger' or 'freight' services.

Default: 'passenger'
type String. 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'
Option Other Settings
maxResults Integer. 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
showOrigin Boolean. This shows the origin of the train in the results grid.

Default: false
showPlatform Boolean. 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

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 documentation here 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.

mmm-uknationalrail's People

Contributors

nwootton avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.