Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

135 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MMM-SNCF

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

WARNING

Due tu a new API change, we need to change the API provider which is now SNCF (https://api.sncf.com) You need to create an account there to get a new API token So your departure station should change For Lille Flandre, it was stop_area:STE:SA:OCE87286005 it is now stop_area:SNCF:87286583

So I could imagine you could easily find the change you have to make. You can also fin your new id there : https://ressources.data.sncf.com/explore/dataset/gares-de-voyageurs/table/?disjunctive.segment_drg&sort=nom and find the id you need

Don't forget to update your config.js file and for coverage set "sncf".

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:{
        departUIC: "stop_area:SNCF:87286583", 
        arriveeUIC: "stop_area:SNCF:87286005", 
        apiKey: "", // You must add your API key
	numberDays: 2,
        dateFormat: 'dddd HH:mm', // display for example with french locale Jeudi 08:43
        displayCo2: true,
        coverage: "sncf",
    }
},

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 Navitia API key, which can be obtained by creating an Navitia account.

This value is REQUIRED
departureStationUIC You need to find your station code using theSNCF API

This value is REQUIRED
arrivalStationUIC You need to find your station code using the SNCF API.

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

WARNING: The option is disabled if the mode option is on '1'.
displayDestination Display the destination of the train.

Possible values: true or false
Default value: false
displayType Display the different types of trips. Possible values: true or false
Default value: false

WARNING: The option is disabled if the mode option is on '1'.
displayC02 Display the C02 emissions for your trip.

Possible values: true or false
Default value: false

WARNING: The option is disabled if the mode option is on '1'.
displayHeaders Display columns headers.

Possible values: true or false
Default value: true
dateFormat Format to use for the date of train.
Caution:
h display hours in 12h format / H in 24h
for minutes, it is mm. MM display the month number.

Possible values: Moment.js formats
Default value: llll
coverage Coverage of departure station REQUIRED
With the API change, set sncf
mode Search mode (journeys or departures).

Possible values: 0 (journeys) or 1 (departures)
Default value: 0 (journeys)

Further information and support

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

About

A magic mirror module which retrieve data from SNCF API

Resources

Stars

7 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages