This is a module for the MagicMirror².
Aggregates compressed GTFS static (General Transit Feed Specification) data and displays upcoming departure times of chosen public transportation stops.
Currently, only tested with gtfs.zip provided by "Rīgas satiksme" and some randomly chosen GTFS sources.
Maybe worth adding list of tested sources, hmm
To use this module:
run these commands from MagicMirror directory (usually ~/MagicMirror
), to clone the repo and install dependencies
cd modules
git clone https://github.com/DanielsSt/MMM-public-transport-gtfs
cd MMM-public-transport-gtfs
npm install
afterwards add the following configuration block to the modules array in the config/config.js
file and (re)start MagicMirror:
var config = {
modules: [
{
module: 'MMM-public-transport-gtfs',
config: {
// See below for configurable options
}
}
]
}
Option | Description |
---|---|
gtfsDataUrl |
Required URL to zipped GTFS data Type: string (URL) Example https://saraksti.rigassatiksme.lv/riga/gtfs.zip |
stops |
Required stop_ids of stops you want to display (can be found on stops.txt )Type: string[] Default [] |
domUpdateInterval |
Optional Time between content updates on screen Type: int (milliseconds) Default 60000 milliseconds (1 minute) |
dataUpdateInterval |
Optional Time between GTFS data updates Type: int (milliseconds) Default 86400000 milliseconds (1 day) |
display |
Optional How many upcoming transports to display Type: int Default 10 |
use24HrClock |
Optional Display 24hr clock Type: bool Default true |
minutesOffset |
Optional Offset transport list by X minutes Type: int Default 10 |
config: {
// url to GTFS data
gtfsDataUrl: "https://saraksti.rigassatiksme.lv/riga/gtfs.zip",
// update screen every 30 seconds
domUpdateInterval: 30000,
// update GTFS data daily
dataUpdateInterval: 86400000,
// show next 5 transports
display: 5,
// display time in 24hr format, or set to false - for 12hr clock
use24HrClock: true,
// find your stops in stops.txt
stops: ["0709", "0079", "0075", "7980", "2017"],
// show transports leaving at least 5 minutes in the future
minutesOffset: 5
}
- Only one GTFS data source can be used, maybe I will implement a way to provide and aggregate multiple GTFS sources;
- Startup takes ~15 seconds, most of the time is spent to just download and unzip the GTFS archive;
- Results are not cached, meaning, data is downloaded and parsed after every restart;
- Noticed that sometimes departure times are 1 minute off of officially available information and some shady practices of GTFS (like custom route types) are used;
- Icons displayed next to the route are not complete set, since font-awesome does not provide icon for every possible transport;