GithubHelp home page GithubHelp logo

jean-phi37 / mmm-sncf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jvanoost/mmm-sncf

0.0 1.0 0.0 1.07 MB

A magic mirror module which retrieve data from SNCF API

License: MIT License

JavaScript 94.00% CSS 6.00%

mmm-sncf's Introduction

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
	numberDays: 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
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.
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/

mmm-sncf's People

Contributors

jvanoost 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.