Kamasoutra / MMM-SNCF2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MMM-SNCF

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

WARNING

Due tu SNCF API update, we need to change the API provider which is now Navitia 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_point:OCE:SP:TrainTER-87286005 it is now stop_area:STE:SA:OCE87286005

So I could imagine you could easily find the change you have to make. You can also fin your new id there : https://api.navitia.io/v1/coverage/fr-ne/places/?q=Lille Flandre and find the id you need

Don't forget to update your config.js file and add the coverage of your departure zone.

You can also try to play with navitia playground with your token You can enter this URL to start playing : https://api.navitia.io/v1/coverage/fr-ne/journeys?from=stop_area%3ASTE%3ASA%3AOCE87286005&to=stop_area%3ASTE%3ASA%3AOCE87286583&

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
	numberJourneys: 2,
        dateFormat: 'dddd HH:mm', // display for example with french locale Jeudi 08:43
        displayCo2: true,
        coverage: "fr-ne",
    }
},

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
numberJourneys 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.
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
Check your coverage Select a city near your departure station and check the coverage

Further information and support

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

About

License:MIT License


Languages

Language:JavaScript 94.1%Language:CSS 5.9%