GithubHelp home page GithubHelp logo

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 kristjanesperanto avatar

Stargazers

 avatar Jean-François GUÉRITTE avatar  avatar  avatar Quentin Machard avatar  avatar

Watchers

James Cloos avatar  avatar  avatar solid38 avatar

mmm-sncf's Issues

suite modif API avec navitio

Hello,
j'ai besoin d'aide stp.
j'arrive pas à faire fonctionner ton module.
ex: départ de sollies-pont en TER pour une arrivée à toulon (gare sncf)
Extrait du cfichier stops.txt de navitio...
STE:SP:StopPoint:OCETrainTER-87755330,1,"Sollies- Pont",43.190871,6.0463,0,0,STE:SA:StopArea:OCE87755330,Europe/Paris,,STE,,0

STE:SP:StopPoint:OCETrainTER-87755009,1,"Toulon",43.128353,5.929404,0,0,STE:SA:StopArea:OCE87755009,Europe/Paris,,STE,,0

API est bien celle de navitio ? et plus de sncf

J'ai écrit cela ci-dessous mais cela ne marche pas
Tu aurais une idée stp
Un grand merci d'avance.
config:{
departureStationUIC: "stop_area:STE:SA:OCE87755330",
arrivalStationUIC: "stop_area:STE:SA:OCE87755009",
apiKey: "mon api navitio",
numberDays: 5,
maxNbTransfers: 0,
displayDestination: true,
dateFormat: 'dddd HH:mm',
coverage: "fr-se",
displayCo2: true,
}

Chargement des prochains trains...

Bonjour,

Le module n'affiche plus les trains.
Seul "Chargement des prochains trains" est affiché.
J'ai testé indépendamment l'URL Navitia avec mes données et en entrant mon token, le site me renvoie bien des données.
Avez-vous une idée ?

Merci d'avance.

Problème d'horaires

bonjour
Merci pour le super job sur le module
par ailleurs j'ai un petit problème, les horaires qui s'affichent sur le mm entre mes 2 gares de référence sont faux
le numéro du train par contre est bon sais tu d'ou peut provenir le problème ?
merci
Cdt
camille

Originally posted by @link5959 in #4 (comment)

Horaires affichés temps réel ?

Salut jvanoost...merci pour la maj maintenant j'arrive à avoir les horaires de trains sur ma ligne préférée....Super job.
Une question les horaires affichés sont-ils des horaires en temps réels (retards pris en compte)...ou seulement les horaires théoriques.
Sinon pourrais-tu me dire si c'est difficile de faire afficher les horaires en temps réels ?
Merci pour ta réponse..
Cdlt
Stpehane

Loading next trains

Salut jvanoost,
Merci pour ce travail. Ton module serait super pratique pour moi en revanche je n'arrive pas à le faire fonctionner. J'ai bien la clé api de la sncf. Il y a des lettres et des chiffres avec des tirets. Sur mon miroir je n'ai que "loading next train." Dans un mail que j'ai reçu la sncf dit de mettre la clé en login et de laisser vide le mdp. Est-ce bien ça ? Merci d'avance de ton aide

destination

Re bonjour,

toujours un plaisir avec ce module. J'utilise aussi le module widget pour taper l'adresse du site de la sncf..Evidemment, tous les 2 mois, cela ne marche plus pour l'accès. Mais du coup je me demandais s'il était possible de ne plus renseigner la destination et de voir ainsi tous les trains au départ d'une gare et avoir les destinations de renseignées.

au plaisir

Multiples configs

J'aimerai faire plusieurs configs.
Comment faire ?
Quand je charge 2 fois le modules seul la dernière config semble fonctionner pour la récupération d'info

Numéro de voie

Bonjour à tous,

Je voudrais savoir si c'est possible de récupérer le numéro de voie ?

Dans mon cas j'ai plusieurs voie possible pour la même destination.

Merci d'avance
Bonne journée !

MMM-SNCF show me some buses

Hello,
I'm reproducing a magic mirror and I have installed the MMM-SNCF module. I made my configuration and everythings works.
But he show me sncf buses and sncf trains. Is there a way to filter just trains and not buses from sncf (the number of the stop area for buses and trains are the same).
Thanks in advance.

Bonjour,
Je reproduis actuellement un "Magic Mirror" et j'ai installer le module MMM-SNCF. J'ai fait ma configuration et tout marche parfaitement. Mais il me montre aussi bien des bus sncf que des trains (les 2 sont possibles pour aller de mon point A à mon point B). Y a t'il un moyen de filtrer pour n'avoir que les trains (sur l'affichage du module, il y a une différence d'icône entre le train et le bus donc je suppose que c'est filtrable).
Merci d'avance

Evan Pasquiet

Question about state and others

Salut,

image

do i understand "reduced service" is "perturbations" ?
i have always "undefined" below "on time". Is it normal ?
did you work about new api to have all destinations about a station ?

have a good day

Chargement des prochains trains...

Bonjour @abrochet et @jvanoost ,

Impossible d'avoir les horaires sur mon écran, j'ai sans cesse "Chargement des prochains trains..."

image

Voici ma config :

{
module: 'MMM-SNCF',
position: 'bottom_left',
header: 'Prochain train',
config:{
departureStationUIC: "stop_area:OCE:SA:87286005", // identique au config d'origine
arrivalStationUIC: "stop_area:OCE:SA:87286583", // identique au config d'origine
apiKey: "xxxxxxxx",
numberDays: 1,
updateInterval: 300000,
initialLoadDelay: 5000,
dateFormat: 'dddd HH:mm', // display for example with french locale Jeudi 08:43
displayCo2: false,
}
},

Une idée sur comment résoudre le problème ?
Merci d'avance,

  • Maxence

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.