chiabre / MBTAlive

Do What The F*ck You Want To Public License
1 stars 0 forks source link

MBTALive Sensor for Home Assistant

Overview

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).

Features

Installation

  1. Get the MBTA api key.
  2. Obtain the configuration valeus
  3. Copy the custom_component directory into the root directory.

Configuration

To enable this sensor, add the following lines to your configuration.yaml file:

Configuration Variables

Example Configuration

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

Getting Your MBTA API Key

To use this integration, you'll need an API key from the Massachusetts Bay Transportation Authority (MBTA). Follow these steps to obtain your key:

  1. Visit the MBTA API Documentation Page.
  2. Sign up for a free account if you haven't already.
  3. Once logged in, generate a new API key.

How to Obtain Configuration Values

Route

  1. Visit the MBTA website.
  2. Navigate to the "Schedules & Maps" section.
  3. 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.

Depart_from

  1. On the MBTA website, find the schedule for your chosen route (e.g., "Red Line").
  2. Look at the list of stations along the route.
  3. Choose your departure station (e.g., "Alewife"). This is the value you will use for the depart_from configuration option.

Arrive_at

  1. Similarly, on the MBTA website, look at the list of stations along your chosen route.
  2. Choose your arrival station (e.g., "South Station"). This is the value you will use for the arrive_at configuration option.