MMM-MTA-BusAlerts is a module for MagicMirror² that displays real-time service alerts for the New York City MTA Bus system. It includes the ability to filter alerts by specific bus route numbers.
This module utilizes the MTA's Realtime Data Feeds, specifically theBus Alerts API.
Please refer to the MTA Terms and Conditions for API usage.
To install MMM-MTA-BusAlerts, navigate to your MagicMirror² module folder in your terminal and clone the repository:
cd ~/MagicMirror/modules
git clone https://github.com/avianto/MMM-MTA-BusAlerts
Then, install the dependencies:
npm install
To update the module, go to the module's directory and run the following commands:
cd ~/MagicMirror/modules/MMM-MTA-BusAlerts
git pull
npm install
To use this module, add it to the modules
array in the config/config.js
file.
A basic configuration to display the latest 10 alerts for all bus lines:
{
module: 'MMM-MTA-BusAlerts',
position: 'top_left'
},
For more control, you can use all available options:
{
module: 'MMM-MTA-BusAlerts',
position: 'top_left',
config: {
updateInterval: 5 * 60 * 1000,
busRoutes: [], //Array of bus routes to filter (e.g., ["M15", "M34"]).
// An empty array shows all alerts.
maxAlerts: 10,
showRouteNumber: true,
showTimestamp: true,
animationSpeed: 1000,
header: "MTA Bus Alerts",
hideGeneralAlerts: false,
generalThresholdRoutes: 20,
}
},
Option | Type | Default | Description |
---|---|---|---|
updateInterval |
number |
300000 (5 minutes) |
How often the module updates (in milliseconds). |
busRoutes |
array of string s |
[] |
Array of bus routes to filter (e.g., ["M15", "M34"] ). Empty means show all alerts. |
maxAlerts |
number |
10 |
Maximum number of alerts to display. |
showRouteNumber |
boolean |
true |
Show the bus route number as a badge. |
showTimestamp |
boolean |
true |
Show the alert's start time. |
animationSpeed |
number |
1000 |
Speed of DOM updates (in milliseconds). |
header |
string |
"MTA Bus Alerts" |
Module header text. |
hideGeneralAlerts |
boolean |
false |
Set to true to hide system-wide alerts. |
generalThresholdRoutes |
number |
20 |
If an alert affects more than this many routes, consider it "System Wide". |