This is a module for the MagicMirror².
This module displays Chicago Transit Authority (CTA) bus and train arrival times.
In ~/MagicMirror/modules
git clone https://github.com/JHWelch/MMM-CTA.git
No dependencies are required for usage. See below for development dependencies.
You need to obtain API keys to access CTA data. The API keys are two separate keys for two services.
The bus tracker API key can be obtained immediately, the train tracker key can take a few days to register.
To use this module, add the following configuration block to the modules array in the config/config.js
file:
var config = {
modules: [
{
module: 'MMM-CTA',
config: {
// See below for configurable options
}
}
]
}
Option | Required? | Description |
---|---|---|
busApiKey |
Required | See Obtaining CTA API keys |
trainApiKey |
Required | See Obtaining CTA API keys |
stops |
Required | Array of stops to display. See stops option |
updateInterval |
Optional | Refresh time in milliseconds Default 60000 milliseconds (1 minute) |
maxResultsBus |
Optional | Maximum number of bus results to display Default 5 |
maxResultsTrain |
Optional | Maximum number of train results to display Default 5 |
routeIcons |
Optional | True/False - Display icons next to routes. Default true |
showHeaders |
Optional | True/False - Display headers for each stop. Default true |
suffixStyle |
Optional | Style of suffix for the arrival time. long , short , or none Default long |
The stops
option is an array of objects. Each object represents a stop to display.
{
stops: [
{
type: 'bus',
id: 561,
name: 'Chicago and Milwaukee'
},
{
type: 'train',
id: 41410,
name: 'Blue Line'
}
]
}
Property | Description |
---|---|
type |
Type of stop. Either bus or train |
id |
Stop ID. See Finding Stop IDs |
name |
Name of stop. This is displayed in the header of the stop's results. |
- Go to CTA Trackers and select Train or Bus Tracker.
- Search for your stop inside of the given app
- Once you find your stop, obtain the Id. It will be the number at the end of the page's URL
- For train tracker, it may look like
?sid={id}
. Theid
is the stop ID. - For bus tracker, it may look like
Southbound/{id}
. Theid
is the stop ID.
- For train tracker, it may look like
Install dev dependencies
npm install
There is a test suite using Jest.
npm test
# Run linting
npm run lint
# Fix linting errors
npm run fix
This module is inspired by MMM-CTA from NateDee.