-
-
Notifications
You must be signed in to change notification settings - Fork 19
05: Available HA Actions
GTFS2 supports five Home Assistant Actions:
You can use this Action to automate updating the static data from your transit provider.
This Action will erase any files with the same name in gtfs2 folder, download a new zip file, and extract and import the data.

The Remove feed info option is in case you have errors related to the file feed_info.txt in the zip file. This option allows you to remove this from the zip file before it gets imported into the database.
This Action downloads GTFS real-time data to a local file.
You can use this Action to avoid making multiple downloads from the same real-time data source for different trips. For example: you have multiple routes set up from a single GTFS data source. To avoid GTFS2 calling externally for each route and collecting a larger set of data every minute multiple times, you can choose to download via a single call, and configure your routes to use the locally-created real-time data file instead.
Note
This approach can apply to all GTFS real-time sources, e.g. TripUpdates, VehicleLocations, Alerts

Note
The file downloaded by this Action will have a .rt extension added to the name that was entered
API key: Usually a long, random-looking string that you got from your transit provider API key name: This depends on the service provider. Common API key names are:
-
Authorization: The default value, and covers key previously labeled asapi_key x_api_keyapiKeyocp_apim_subscription_key
You are free to type in any key name that applies to your provider requirements.
If your provider requires an authentication method with a (x_)api_key, you can apply that either in an HTTP header or as part of the URL's query parameters. Check with the transit provider to know which method applies.
Debug output: For convenience when debugging this Action, GTFS2 can create a human-readable file in your www/gtfs2 folder. This can help identify if your provider includes the details for your route/trip. This debug file will have a _converted.txt added to the name that was entered.
Warning
This feature is experimental. The few sources investigated so far are deviating considerably on structure and content. At the moment this feature only works for MTA / New York.
This Action's configuration requires:
- The URL for the SIRI data. For example, something like:
https://bustime.mta.info/api/siri/stop-monitoring.json?key=YOUR-KEY&OperatorRef=MTA - A configured route. Only static origin/destination route entities are supported (i.e. not dynamic location routes).
The file generated by this Action will need to be referenced in the route entity's configuration settings, in the real-time setting. For example http://your-ha-ip/local/gtfs2/your-filename_rt.json

If you have another SIRI source, please raise a feature request.
This Action updates the available departures for a dynamically-configured route (i.e. linked to a location-changing person).
Tip
Don't trigger this action via automation with high frequency, as this is usually not required. I recommend that you base such automations on when the tracked' person's lat/lon is 'stable' for a while. Keep in mind that instead of timed automation, you can also call this Action on-demand via a Button.

This Action queries a configured route's departures, covering today and tomorrow only.
The regular HA entity for a GTFS2 route only covers up to 10 future departures to avoid overflow of the attributes length. With this Action you can query all departures from today and tomorrow.
By optionally providing a time, the Action will only return departures that are past that time. This time cut-off applies to both today's and tomorrow's departures.
Note
The Action's response will only include future departures, irrespective of the time entered.
Note
The times in the Action response are in UTC.

If you are at a stop that serves multiple transport vehicles, it may be interesting to know which trip serves what stops. This action allows you to query that information.
Note
This Action is in early development. For improvements, please raise a request
