Skip to content

01: Initial Setup of the Static GTFS Data Source

Mordy Ovits edited this page Jul 19, 2026 · 6 revisions

Initial setup

The GTFS2 integration depends heavily on the static GTFS data from transit providers. The static data contains the scheduled trips, i.e. when/where the vehicles run. The first thing you have to do is import this static GTFS data. Later on you can configure routes & sensors, add real-time feed sources, etc.

Set up a new GTFS static datasource

From the Main Menu, select Setup a new datasource. You will be presented with this dialog:

add-static-datasource

Choosing between URL and Zip file

You can enter a URL where the zip file can be found, or you can manually put a zip file where the GTFS2 integration expects it.

Using a URL

  1. Select the URL radio button.
  2. Enter a simple datasource name. This will be used internally to track the GTFS data so keep it simple, e.g. metronorth.
  3. Paste the URL into the external url field.
  4. Optionally: Enter an api key & api key name for the transit provider. Then choose where the key is applied.
  5. Click Submit.

Using a Zip file

Note

This method is more advanced and can run into issues about directory placement, file permissions, etc. Prefer using a URL.

If you do not have a URL or you want to download the file manually for other reasons:

  1. In the Home Assistant installation create a gtfs2 directory in the config directory, i.e. config/gtfs2.
  2. Put the GTFS zip file in that directory. Note the exact name of the zip file.
  3. Using Main Menu > Setup a new datasource, select the ZIP radio button.
  4. In the datasource name, enter the filename of the zip file, without the .zip ending. If the zip file is name trains.zip, enter trains as the datasource name.
  5. Click Submit.

Extraction of data from the datasource

After you click Submit, you will see this dialog:

image

Behind the scenes, GTFS2 is importing the zip file. The import process can take a LONG time.

Important

You will NOT get any indication in the HA web UI that the import process is done. You can just close the above dialog, because the import process will run to completion behind the scenes -- or it won't, and you will need to read the logs.

You can sort of monitor the import process by watching the config/gtfs2 directory. The importer unzips the file and transforms it into an indexed .sqlite file. When the sqlite file is done, the import process is done. If you see journal or wal files next to the sqlite file, or the sqlite file is still growing in size, the import is not done yet.

image

Wait a while for the import to complete. Then you can use the imported static data to use the other options in the Main Menu to add stuff from the imported data into HA.

Adding a route

After you've completed the import of static data, you can use the Main Menu to add a route.

Clone this wiki locally