-
-
Notifications
You must be signed in to change notification settings - Fork 19
03: Adding a location‐based dynamic departures sensor
GTFS2 allows you to create an HA sensor entity that dynamically shows transit departures in your vicinity, dynamically updating available departures as you move around. The purpose is to help you find transport based on your geographical position.
To use this feature, you must have your Home Assistant configured with a entity that has positional data (i.e. latitude, longitude). That entity can be a Person (e.g. person.xyz) or a Zone (e.g. zone.xyz). A Person with positional data is usually acquired though a mobile phone and the HA companion app, but other methods exist.
The default radius searched is 300m. You can configure the search radius to shrink or grow the area searched.
Note
For performance impact prevention, there is a limit of 15 stops returned in the searched range. If you bump into this limit then you should reduce the radius.
In the Main Menu:

- Select the GTFS data source to be searched for nearby departures.
- Select a positional entity. The dropdown will only offer entities of type 'person' or 'zone'
- Choose a name for the sensor. It's good practice to choose a name that combines entity and source (e.g.
Foo Nederlandin the screenshot), especially when you are using multiple sources or when multiple people use the same source.
Note
These sensors can only collect data from stops existing in the chosen source. If your area is served by multiple providers, each with their own GTFS data source, then you need to add a sensor for each one of them.
The sensor is created.
Note
Depending on where the person or zone is located at the time your are setting this sensor up, the number of stops shown with future departures could very well be 0.

It will create sensors per stop containing the next departures, for example:

| Field | Description |
|---|---|
departure: '08:30' |
scheduled departure time in local stop timezone |
departure_datetime: '2024-11-04T07:30:00+00:00' |
scheduled departure time in local stop timezone, as utc |
departure_realtime: '08:27' |
estimated departure real-time, received from the data-source/provider, in local stop timezone |
departure_realtime_datetime: '2024-11-04T07:27:46+00:00' |
estimated departure real-time, received from the data-source/provider, in local stop timezone, as utc |
delay_realtime_derived: '-0:02:14' |
estimated delay, derived from departure time and real-time, shows '-' if 0 or non-existing real-time. Can be negative if departure is estimated before the scheduled time. |
delay_realtime: '-' |
delay, received from the data-source/provider, shows '-' if 0 or non-existing |
date: '2024-11-04' |
date related to the scheduled data |
stop_name: My City Centre |
name of the stop for which the data is shown |
route: B |
route for which the data is shown |
route_long: My City Center - via Town XYZ - End Station |
long name of the route for which the data is shown |
headsign: End Station |
headsign of the vehicle for which the data is shown |
trip_id: '1907425342153' |
? |
direction_id: 1 |
? |
icon: mdi:bus |
? |