/MMM-SNCF

A magic mirror module which retrieve data from SNCF API

Primary LanguageJavaScriptMIT LicenseMIT

MMM-SNCF

MMM-SNCF was developped from the MMM-Transilien module.

Installation

Clone the git in the /modules folder of Magic Mirror and run the "npm install" command which will installed the required node modules

Example

Transfer route:

Module SNCF

Unmatched trip:

Module SNCF

No train available:

Module SNCF

Using the module

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

{
    module: 'MMM-SNCF',
    position: 'top_right',
    header: 'Lille-Flandres to Orchies',
    config:{
        departureStationUIC: "stop_area:OCE:SA:87286005",
        arrivalStationUIC: "stop_area:OCE:SA:87286583",
        apiKey: "", // You must add your API key
	numberDays: 2,
        dateFormat: 'dddd HH:MM',
        displayCo2: true,
    }
},

Configuration options

The following properties can be configured:

Option Description
updateInterval How often do the trains have to change? (Milliseconds)

Possible values: 1000 - 86400000
Default value: 60000 (60 seconds)
animationSpeed Speed of the update animation. (Milliseconds)

Possible values:0 - 5000
Default value: 2000 (2 seconds)
debugging Display logs in console.

Possible values: true or false
Default value: false
retryDelay The delay before retrying after a request failure. (Milliseconds)

Possible values: 1000 - 60000
Default value: 10000
initialLoadDelay The initial delay before loading. If you have multiple modules that use the same API key, you might want to delay one of the requests. (Milliseconds)

Possible values: 1000 - 5000
Default value: 0
apiKey The SNCF API key, which can be obtained by creating an SNCF account.

This value is REQUIRED
departureStationUIC You need to find your train station and find the UIC of the train station (not the uic7 column, the UIC).

This value is REQUIRED
arrivalStationUIC You need to find your train station and find the UIC of the train station (not the uic7 column, the UIC).

This value is REQUIRED
numberDays Number of results per day.

Default value: 1
maxNbTransfers Maximum number of transfers in each journey.

Default value: 10
displayName Display train name and type.

Possible values: true or false
Default value: true
displayDuration Display journey time.

Possible values: true or false
Default value: true
displayDestination Display the destination of the train.

Possible values: true or false
Default value: false
displayC02 Display the C02 emissions for your trip.

Possible values: true or false
Default value: false
displayHeaders Display columns headers.

Possible values: true or false
Default value: true
dateFormat Format to use for the date of train.

Possible values: Moment.js formats
Default value: llll

Further information and support

Please use the forum of magic mirror² https://forum.magicmirror.builders/