This is a module for the MagicMirror² to display Hungarian public train departure times using real-time data from the "Elvira" service provided by the Hungarian national railway company (MÁV).
The module also shows the delays of the next trains highlighted:
This module is capable to display only a single station and route data. If you would like to see the departure times of more stations and routes on your mirror, add this module multiple times.
For updates, please check the CHANGELOG.
To use this module follow these steps:
- Clone this repository to the
modules
folder of your MagicMirror:
git clone https://github.com/balassy/MMM-Elvira.git
- Step into the newly created folder:
cd MMM-Elvira
- Install third-party dependencies:
npm install
- Add the following configuration block to the modules array in the
config/config.js
file:
var config = {
modules: [
{
module: "MMM-Elvira",
position: "top_right",
header: 'Déli pályaudvar - Biatorbágy',
config: {
startStationCode: '005501016',
endStationCode: '005501057',
updateInterval: 60000,
headText: 'Déli - Biatorbágy',
showHead: true,
showSymbolInHead: true,
maxNumberOfItems: 10
}
}
]
}
Option | Description |
---|---|
startStationCode and endStationCode |
REQUIRED The unique identifiers of the first and last stations of the route. See below for more details about how to acquire them. Type: string Default value: (empty) |
updateInterval |
Optional The frequency of when the module should query the departure times from the Futár service. Type: int (milliseconds) Default value: 60000 milliseconds (1 minute) |
headText |
Optional The content of the custom headline inside the module. Type: string Default value: (empty) |
showHead |
Optional Determines whether the module should display a custom headline (independently from the standard headline of the module). Use the headText property to specify the text. Type: boolean Default value: true |
showSymbolInHead |
Optional Determines whether the custom headline should include a train icon. Type: boolean Default value: true |
maxNumberOfItems |
Optional Determines the limit for the number of displayed departure times. Type: number Default value: 5 |
fade |
Optional Determines whether the future stop times are gradiently faded to black. Type: boolean Default value: true |
fadePoint |
Optional Determines where the fading should be started. Type: double Possible values: 0 (top of the list) - 1 (bottom of the list)Default value: 0.25 |
To get the start and end station identifiers required by this module, follow these steps:
-
Launch Google Chrome or Microsoft Edge and navigate to https://jegy.mav.hu/.
-
Open the Developer Tools (F12) and enable network monitoring.
-
On the webpage enter your preferred departure and destination stations and start a search.
-
Examine the
POST
XHR request to theGetOfferRequest
endpoint, you will seestartStationCode
andendStationCode
in the request payload.
This module periodically sends requests from the browser window of the MagicMirror Electron application to the Elvira webservice. Although the service is free and public, its API is not publicly documented, so the module was created by understanding the current communication on the https://jegy.mav.hu/ webpage.
The API does not require any API key.
Currently this module supports English (en
) and Hungarian (hu
) languages. The language can be specified in the global language
setting in the config.js
file.
Want to see more languages? Please contribute!
Although for operation this module does not depend on any other module, if you would like to contribute to the codebase, please use the preconfigured linters to analyze the source code before sending a pull request. To run the linters follow these steps:
- Install developer dependencies:
npm ci
- Run all linters:
npm run lint
Your feedback is more than welcome, please send your suggestions, feature requests or bug reports as GitHub issues.
Many thanks to:
- Michael Teeuw for creating and maintaining the MagicMirror² project fully open source.
- Bálint Berente for reverse engineering and publishing information about the MÁV API.
This project is created and maintaned by György Balássy.