Skip to main content

BART smart home integration, free and open source

BART integration for Gladys Assistant

Real-time BART departures and service advisories in the San Francisco Bay Area.

Real-time departures and service advisories of BART (Bay Area Rapid Transit), the San Francisco Bay Area metro, in Gladys Assistant.

The integration reads the public BART API (cloud, internet access required). No account is needed: the public BART API key is used by default.

Installation​

  1. In Gladys, open Integrations, then the external integrations store.
  2. Search for BART and click Install.
  3. Wait for the container to start: the integration shows up in the list.

Configuration​

Open the Configuration tab of the integration:

  • Stations to follow: the BART stations whose departures you want (Embarcadero by default). Each one becomes a Gladys device.
  • Approach alert (min): the "BART train approaching" scene trigger fires when a train is this many minutes away (5 by default).
  • Refresh interval (s): how often the BART API is read, one minute minimum (60 s by default).
  • BART API key (optional): leave empty to use the public key. Enter your own key, obtained on the BART developer page, if the public key is rate-limited.

Save, then click Test the BART connection: the message shows the number of departures announced at your first station and the service state.

Devices​

Open the Discover tab and add the devices:

  • BART network: the active service advisories and the elevator status.
  • BART <station> (one per followed station): next departure (minutes, 0 = train leaving), next destination, delay of the next train (minutes) and the summary of the departures by destination (e.g. SF Airport 0, 15 min · Antioch 12, 27 min).

Scenes and dashboards​

Scene triggers:

  • BART train approaching: a train is about to leave a followed station (within the approach alert). Filters: station, destination, direction. Variables: station, destination, minutes before departure, platform, line color, delay.
  • BART service advisory: BART posted a new advisory. Filter: type (delay, emergency, other). Variables: advisory text, affected area.
  • BART service back to normal: every advisory has been lifted.
  • BART elevator status changed: BART updated the elevator status (variable: the status text).

The triggers fire on changes only: restarting the integration does not replay the current situation.

Scene actions:

  • Get the next BART train: reads the next departure of a station, optionally towards a destination or in one direction. Outputs: train found, station, destination, minutes before departure, platform, line color, delay. Example: before leaving home, say "Next train to Antioch in 7 minutes".
  • Refresh BART data: reads the departures and advisories now. Outputs: stations read, active advisories, advisory texts.

Dashboard widget BART departures: the next train, the next departures per destination (delayed ones in orange), the service state, the advisory texts and a Refresh button. Choose the station in the widget settings (by default, the first followed station).

Help​

A question or a problem? Ask on the Gladys community forum or open an issue on the GitHub repository.

Configuration settings​

These are the settings BART asks for in its configuration screen in Gladys.

SettingTypeRequiredDescription
Getting startedsectionNoPick the BART stations to follow: each one becomes a device with its next departures. The public BART API key is used by default; you can enter your own.
Stations to followmulti_selectYesOne Gladys device per station, with its real-time departures.
Approach alert (min)numberNoThe "Train approaching" scene trigger fires when a train is this many minutes away.
Refresh interval (s)numberNoHow often the BART API is read, in seconds (one minute minimum).
BART API key (optional)secretNoLeave empty to use the public BART key.

How to install BART in Gladys​

  1. In Gladys, open Integrations: BART appears in the catalog, next to the native integrations, with a community badge.
  2. Click Install. Gladys pulls the Docker image (ghcr.io/prohand/gladys-bart:1.1.0), starts it in a sandbox isolated from the core, and generates the integration's interface (devices, discovery and configuration).
  3. Open the Configuration screen of the integration, fill in the settings, and save.
  4. You can also install it directly from its repository URL: https://github.com/prohand/gladys-bart.

BART requires Gladys >=5.3.0. The catalog inside Gladys refreshes every hour, so a new version becomes available at most one hour after its release.

Not running Gladys yet? It is free and open source: follow the installation guide to get started.

About external integrations​

BART is an external integration: a community integration packaged as a Docker container and published on GitHub, that Gladys installs in one click and runs in a sandbox isolated from its core. It is published and maintained by prohand, not by the Gladys core team.

Subscribe to the Gladys Assistant newsletter

A few emails per month about new releases and project news. Sent by Pierre-Gilles Leymarie, founder of the project. Unsubscribe anytime 🙂