MBTA Boston Smart-Home-Integration, kostenlos und Open Source

Unofficial. Next MBTA departures and service alerts at your stops (Boston).
Die Dokumentation dieser Integration wird von ihrem Autor geschrieben und ist bisher nur auf Englisch verfügbar.
The next departures (subway, light rail, bus, commuter rail, ferry) and the service alerts at up to five stops of the MBTA (Boston area), in Gladys.
This integration is unofficial: it is not affiliated with the MBTA nor MassDOT, and it is not an official source. Check mbta.com or the stop signs before you travel. It has never been tested on a real Gladys installation by its author; it was checked against the live MBTA API.
Get started in 3 steps
No account and no key: there is nothing to create.
- Find the id of your stop. Open the stop on
mbta.com: the id is the end of the address
of its page.
mbta.com/stops/place-pktrmis Park Street (a station: all its platforms),mbta.com/stops/1is a bus stop. - Install the integration from the catalog, open its configuration and type the id in Stop 1 → Stop id. Save.
- Open the Discover tab and press Add on the stop. Its name is the MBTA name of the stop (e.g. "MBTA – Park Street") once the integration has checked it, or the name you typed.
One device per stop. A device belongs to a slot and to its stop. If you type another stop in a slot, the integration offers a new device in the Discover tab: the device of the old stop is no longer updated and keeps its last values; the configuration page lists it under "Not updated any more", delete it in Gladys. Changing the routes or the direction keeps the device.
The message at the top of the configuration page tells where each stop stands, e.g. "MBTA – Park Street: next in 4 min (Red Line), 9 departure(s) within 60 min, read Oct 30, 08:05 ET; 0 alert(s), read Oct 30, 08:05 ET." The read times come from the MBTA server; the next read and the end of a pause from the clock of the machine that runs Gladys. The Show the last read button shows the same message; it never reads the MBTA itself.
Choosing what you see
| Field | Example | Meaning |
|---|---|---|
| Stop id | place-pktrm | a station: every platform |
| Stop id | 70075 | one platform (here Park Street, Red Line southbound) |
| Only these routes | Red | the Red Line only |
| Only these routes | 1, 47 | buses 1 and 47 (route id or number shown on the bus) |
| Direction | 0 or 1 | 0: outbound, south or west; 1: inbound, north or east |
Each route of the filter must call at the stop: the integration checks it with the MBTA once, and a route that does not call there is refused (the status names it), so that an unknown stop or route is not shown as "no departure".
What each device holds
- Next departure and Following departure: texts with the route, the
destination, the minutes to wait (counted against the time of the MBTA
server) and the departure time, e.g.
Red Line → Ashmont in 4 min (08:09). When there is none, they say so with the time of the read:No predicted departure (read 08:05),No following departure (read 08:05). They are texts so that a departure that no longer exists is never left on the dashboard as a number: Gladys cannot clear a number. - Predicted departures (60 min): how many departures the MBTA predicts at the stop within the next hour.
- Departures: a summary that starts with the time of the read, e.g.
08:05 · Red Line → Ashmont 4, 11 min · Red Line → Alewife 6 min. - Alerts in effect: how many MBTA alerts are in effect now for the stop (and its routes and direction when you filtered them).
- Alert: the text of the most severe one, e.g. "Shuttle buses replace Red Line service… (1 more alert)", or "No alert".
Stop names and alert texts come in English, the only language of the MBTA API. The device names and the summary follow the language you choose.
What the numbers are, and are not
- The departures are the MBTA real-time predictions. A trip the MBTA does not track yet is not counted: a bus that has not left its terminal, a commuter rail train far ahead. "No predicted departure" does not mean "no service"; at night it often means the service has ended.
- When no departure is predicted, the counter shows 0 and the three texts say so. Every read publishes every value again.
- When a read fails, nothing is published: the values of the last good read stay in Gladys. Each text carries its time (the departure time, or the read time), and the configuration page says the data is stale after 3 intervals (5 minutes at least).
- A stop is counted at 0 only when the MBTA has confirmed the stop (and the routes of the filter). Until then an empty answer publishes nothing.
- Nothing is published (no 0, no old value sent again) when a read fails, when the answer cannot be read, when it carries no usable server time, when that time differs by more than 5 minutes from the clock of the machine (a wrong clock, or an old copy served by a cache), or when the MBTA data behind it is more than 10 minutes old (a frozen real-time feed). The configuration page then says so, with the time of the last good data.
Scenes
Trigger "MBTA departure approaching": a predicted departure at a watched stop gets to 1, 2, 3, 5, 10 or 15 minutes or less (you choose), between two reads: it was further at the read before. A departure that appears already that close (the first read after a start, a bus that just left its terminal) is not announced. Example: "when a bus of stop 1 is 5 minutes away, turn the hall light on". The scene gets the minutes, the route, the destination and the departure time.
Trigger "New MBTA alert at a stop": an alert in effect appears at a watched stop for the first time, and it was created, updated or started within the last 2 hours. Filter on the stop (required), the effect (delay, shuttle, suspension, detour, stop or station closed…) and the severity (severe 7 to 10, moderate 4 to 6, minor 0 to 3). The first read of a stop only learns the alerts already there. The scene gets the alert text, its effect, severity, cause, timeframe and link.
The counters work in the usual scenes of Gladys too, e.g. "if the predicted departures of the stop are 0, send me a message".
Pace and courtesy toward the MBTA
The MBTA allows 20 requests per minute without a key. The integration sends one request at a time, 3 seconds apart at least:
- the departures of every stop in one request, at the interval you choose (60 seconds by default, 30 to 600);
- the alerts every 5 minutes, one request per stop;
- the check of the stops (name, routes) once, then again 30 minutes later for a stop or a route the MBTA did not know (1 minute after a failed check, doubled each time, 30 minutes at most).
When the MBTA says its limit is near, the next request waits for the end of
the minute. A "429" (too many requests) pauses every read for 2 minutes,
doubled each time, or until the MBTA limit resets when that is later; a server
error on the departures pauses the reads too (1 minute, doubled each time).
A pause lasts 6 hours at most. The pause is kept across a
restart, and a restart waits for the interval after the last read (30 seconds
after the start when /data cannot tell when that was). A failure of the
alerts or of the stop check, other than a 429, never holds the departures,
and a failed stop check never holds the alerts.
Troubleshooting
| Message | What to do |
|---|---|
| "the MBTA does not know this stop id" | Check the id at the end of the stop page on mbta.com. |
| "a route of the filter does not call at this stop" | Fix or remove the route named in the message (use the route id or the bus number). |
| "the stop could not be checked yet" | The MBTA was not reachable for the check; it is tried again, the departures are read anyway. |
| "differs from the clock of this machine" | Set the clock of the machine running Gladys (automatic time); the reads resume by themselves. |
| "Not updated any more … delete in Gladys" | A slot was given another stop: delete the old device in Gladys. |
| "frozen feed" | The MBTA real-time data is not updated; nothing is published until it is. |
| "MBTA asked to slow down (429)" | Another program on your network may use the MBTA API too; the reads resume by themselves. |
| A stop stays at "No predicted departure" | Normal at night, or for a route whose next trip is not tracked yet. |
Privacy, data and licences
- No account, no key, no location: only the stop ids you type are sent to the MBTA, in the address of the requests.
- Data: MassDOT / MBTA (
api-v3.mbta.com), used under the MassDOT Developers License Agreement. MassDOT makes no warranty on the data, nor does this integration. - Integration code: Apache 2.0 licence.
Konfigurationseinstellungen
Diese Einstellungen fragt MBTA Boston in seinem Konfigurationsbildschirm in Gladys ab.
| Einstellung | Typ | Pflichtfeld | Beschreibung |
|---|---|---|---|
| MBTA departures and alerts | section | Nein | The next departures (subway, light rail, bus, commuter rail, ferry) and the service alerts at up to five stops of the MBTA (Boston area), read from the public MBTA V3 API: no account, no key. Each stop is a device. The departures are the MBTA real-time predictions: a trip that is not tracked yet is not counted. Data: MassDOT / MBTA, in English only, under the MassDOT Developers License Agreement. Check mbta.com before you travel: this integration is not an official source. |
| Language of the texts | select | Nein | Language of the device names and of the departure summary (MBTA stop names and alerts stay in English). |
| Read interval of the departures (seconds) | number | Nein | From 30 to 600 seconds. One request reads the departures of every stop; the alerts are read every 5 minutes. The MBTA allows 20 requests per minute without a key. |
| Stop 1 | section | Nein | A stop or a station of the MBTA. Its id is at the end of its page on mbta.com: mbta.com/stops/place-pktrm is Park Street (a station: every platform), mbta.com/stops/1 a bus stop. Required. |
| Name | string | Nein | Name of the device in Gladys (60 characters at most). Empty: the MBTA name of the stop. |
| Stop id | string | Ja | The id of the stop or station on mbta.com (letters, digits, - and _). |
| Only these routes | string | Nein | Optional: route ids or bus numbers, separated by commas ("Red", "Green-B", "1, 47", "CR-Worcester"). Each one must call at the stop. Empty: every route of the stop. |
| Direction | select | Nein | The MBTA numbers the two directions of a route 0 and 1. |
| Stop 2 (optional) | section | Nein | A stop or a station of the MBTA. Its id is at the end of its page on mbta.com: mbta.com/stops/place-pktrm is Park Street (a station: every platform), mbta.com/stops/1 a bus stop. Leave the id empty to turn it off. |
| Name | string | Nein | Name of the device in Gladys (60 characters at most). Empty: the MBTA name of the stop. |
| Stop id | string | Nein | The id of the stop or station on mbta.com (letters, digits, - and _). |
| Only these routes | string | Nein | Optional: route ids or bus numbers, separated by commas ("Red", "Green-B", "1, 47", "CR-Worcester"). Each one must call at the stop. Empty: every route of the stop. |
| Direction | select | Nein | The MBTA numbers the two directions of a route 0 and 1. |
| Stop 3 (optional) | section | Nein | A stop or a station of the MBTA. Its id is at the end of its page on mbta.com: mbta.com/stops/place-pktrm is Park Street (a station: every platform), mbta.com/stops/1 a bus stop. Leave the id empty to turn it off. |
| Name | string | Nein | Name of the device in Gladys (60 characters at most). Empty: the MBTA name of the stop. |
| Stop id | string | Nein | The id of the stop or station on mbta.com (letters, digits, - and _). |
| Only these routes | string | Nein | Optional: route ids or bus numbers, separated by commas ("Red", "Green-B", "1, 47", "CR-Worcester"). Each one must call at the stop. Empty: every route of the stop. |
| Direction | select | Nein | The MBTA numbers the two directions of a route 0 and 1. |
| Stop 4 (optional) | section | Nein | A stop or a station of the MBTA. Its id is at the end of its page on mbta.com: mbta.com/stops/place-pktrm is Park Street (a station: every platform), mbta.com/stops/1 a bus stop. Leave the id empty to turn it off. |
| Name | string | Nein | Name of the device in Gladys (60 characters at most). Empty: the MBTA name of the stop. |
| Stop id | string | Nein | The id of the stop or station on mbta.com (letters, digits, - and _). |
| Only these routes | string | Nein | Optional: route ids or bus numbers, separated by commas ("Red", "Green-B", "1, 47", "CR-Worcester"). Each one must call at the stop. Empty: every route of the stop. |
| Direction | select | Nein | The MBTA numbers the two directions of a route 0 and 1. |
| Stop 5 (optional) | section | Nein | A stop or a station of the MBTA. Its id is at the end of its page on mbta.com: mbta.com/stops/place-pktrm is Park Street (a station: every platform), mbta.com/stops/1 a bus stop. Leave the id empty to turn it off. |
| Name | string | Nein | Name of the device in Gladys (60 characters at most). Empty: the MBTA name of the stop. |
| Stop id | string | Nein | The id of the stop or station on mbta.com (letters, digits, - and _). |
| Only these routes | string | Nein | Optional: route ids or bus numbers, separated by commas ("Red", "Green-B", "1, 47", "CR-Worcester"). Each one must call at the stop. Empty: every route of the stop. |
| Direction | select | Nein | The MBTA numbers the two directions of a route 0 and 1. |
So installierst du MBTA Boston in Gladys
- Öffne in Gladys Integrationen: MBTA Boston erscheint im Katalog neben den nativen Integrationen, mit einem Community-Badge.
- Klicke auf Installieren. Gladys lädt das Docker-Image (
ghcr.io/lm1lc3n7/gladys-mbta:0.1.1) herunter, startet es in einer vom Kern isolierten Sandbox und erzeugt die Oberfläche der Integration (Geräte, Erkennung und Konfiguration). - Öffne den Bildschirm Konfiguration der Integration, fülle die Einstellungen aus und speichere.
- Du kannst sie auch direkt über die URL ihres Repositorys installieren: https://github.com/LM1LC3N7/gladys-mbta.
MBTA Boston benötigt Gladys >=5.1.0. Der Katalog in Gladys wird stündlich aktualisiert, eine neue Version ist also spätestens eine Stunde nach ihrer Veröffentlichung verfügbar.
Du nutzt Gladys noch nicht? Es ist kostenlos und Open Source: folge der Installationsanleitung, um loszulegen.
Über externe Integrationen
MBTA Boston ist eine externe Integration: eine Community-Integration, die als Docker-Container verpackt und auf GitHub veröffentlicht wird. Gladys installiert sie mit einem Klick und führt sie in einer vom Kern isolierten Sandbox aus. Sie wird von LM1LC3N7 veröffentlicht und gepflegt, nicht vom Gladys-Kernteam.
- Alle Integrationen durchsuchen, native und aus der Community
- Deine eigene externe Integration bauen und veröffentlichen
- Quellcode auf GitHub — Quelle dieser Dokumentation