This Home Assistant integration allows you to track live MBTA (Massachusetts Bay Transportation Authority) transit schedules and predictions. By configuring your desired routes, departure, and arrival stops, you can receive real-time updates on expected arrival and departure times, delays, and other transit information.
This project is inspired by the MBTA Predictions. It aims to address the new API key requirement and enhance the original project with additional features and customization options (WIP).
- Real-time MBTA transit schedules and predictions.
- Configurable routes, departure, and arrival stops.
- Time offsets for precise scheduling.
- Support for round trips.
- Frequent updates (default scan interval: 30 seconds).
- Get the MBTA api key.
- Obtain the configuration valeus
- Copy the custom_component directory into the root directory.
To enable this sensor, add the following lines to your configuration.yaml
file:
- api_key: (Required) Your MBTA API key.
- trips: (Required) A list of trips to monitor. Each trip can have the following attributes:
- name: (Optional) A custom name for the trip. Defaults to
MBTA
. - route: (Required) The route name.
- depart_from: (Required) The departure stop name.
- arrive_at: (Required) The arrival stop name.
- round_trip: (Optional) Whether to include the return trip. Defaults to
false
. - offset_minutes: (Optional) Time offset in minutes, trips leaving earlier than the offset won't be shown. Defaults to
0
. - trips_limit: (Optional) The maximum number of trips to show. Defaults to
2
.
- name: (Optional) A custom name for the trip. Defaults to
sensor:
- platform: mbta
api_key: YOUR_MBTA_API_KEY
trips:
- name: "Morning Commute"
route: "Red Line"
depart_from: "Alewife"
arrive_at: "Harvard"
round_trip: false
offset_minutes: 10
trips_limit: 5
- name: "Evening Commute"
route: "Red Line"
depart_from: "Harvard"
arrive_at: "Alewife"
round_trip: true
offset_minutes: 5
trips_limit: 3
To use this integration, you'll need an API key from the Massachusetts Bay Transportation Authority (MBTA). Follow these steps to obtain your key:
- Visit the MBTA API Documentation Page.
- Sign up for a free account if you haven't already.
- Once logged in, generate a new API key.
- Visit the MBTA website.
- Navigate to the "Schedules & Maps" section.
- Choose the line you are interested in, such as the "Red Line." The name of the route (e.g., "Red Line") is the value you will use for the
route
configuration option.
- On the MBTA website, find the schedule for your chosen route (e.g., "Red Line").
- Look at the list of stations along the route.
- Choose your departure station (e.g., "Alewife"). This is the value you will use for the
depart_from
configuration option.
- Similarly, on the MBTA website, look at the list of stations along your chosen route.
- Choose your arrival station (e.g., "South Station"). This is the value you will use for the
arrive_at
configuration option.