GTFS for Public Transport revamped

Hi, having used bits and pieces of the existing gtfs core integration, I thought to revamp it. As an initial step I created a HACS Integration that combines gtfs static and realtime, bits and pieces copied and enhanced.
It has been tested by a few people and seems OK enough to go out there :slight_smile:
Main challenges I have seen so far are inconsistencies in the data from the gtfs providers. Am interested in feedback

vingerha/gtfs2: Support GTFS in Home Assistant GUI-only (github.com)

This is an adaptation of the GTFS integration in HomeAssistant Core, enhancements:

  • configuration via the GUI, no configuration.yaml needed
  • Uses a route to further select start/end stops
  • Shows next 10 departures on the same stretch start/end , including alternative transport lines if applicable
  • allows to load/update/delete datasources in gtfs2 folder from the GUI
  • Option to add gtfs realtime source/url
  • Option to add gtfs realtime vehicle location source/url, generates geojson file which can be used for tracking vehicle on map card
  • Option to add gtfs realtime alerts source/url
  • A service to update the GTFS static datasource, e.g. for calling the service via automation
  • translations: English and French

Github link for ssues and features

7 Likes

PR to core?

In time maybe but due to the extensive changes they wanted a piece-meal approach which is, for me, not in scope untill I know there is an larger interest in gtfs

Hi @vingerha

Thanks for that mod as I gave up in past with gtfs official integration as it was not really working well ! I wanted to test it remotely but I’ll have to wait to be back home as I can’t upload the zip file remotely using HA File Manager unhappy.

Vincèn

If you can get to the front-end then this is all you need … check the documentation which I just updated :slight_smile:
EDIT, I would appreciate if you share the url/link to the zip file for my reference/test

Well the source I use is only avalaible as a ZIP (CFF, Switzerland) and file is too big to upload through the HAOS File manager :frowning:
Just thinking I could just upload it on one of my webserver and give that url it should work no ?

it’s that one: Timetables GTFS - Groups | Open-Data-Plattform öV Schweiz

Indeed, via this link below which you can use in the integration, no need to upload via backenb, again…read the doc :slight_smile:
Unpacking may take 1-2 hours though

https://opentransportdata.swiss/dataset/7cc000ea-0973-40c1-a557-7971a4939da3/resource/184fea8b-6f93-460e-bdb1-9fad5f9b82aa/download/gtfs_fp2024_2023-12-13_04-15.zip

Thanks and yeah it worked fine giving it the URL of the zip file on my webserver :wink:
I confirm it took nearly 3 hours to extract all datas from zip.
My only issue now, but I guess the problem is the GTFS file itself, is that all routes proposed have just cryptic names and the list is insane so unusable unhappy with that GTFS file of CFF :frowning:

New sensors, visualizing departures from stops around you (. e.g using HA companion app.)

Up to 500m ‘radius’

1 Like

Thanks for your work with this, it’s great. I’ve had a few challenges (but I’m 99% confident its to do with the way that Transport for NSW (in Australia) use GTFS)

Would it be possible to add Zones to the stops around you functionality?

That is cool integration I was looking for :+1:

Can someone suggest how to filter local stop list to include only specific Stops and only specific Routes or Headsign (direction).

gtfs2-list

In this case you would have to use the filtering in (for this example above) flex-table card. An idea is to add auto-entities card on top and tweak it via that one.
EDIT: in ‘worst’ case you can always use the markdown card…which will come with template elements for filtering.

I just set this up for BKK/Volán (In Hungary) works like a charm, and the setup was fairly easy. Thanks for the work you put into that.

The original component is a pain to use because of the frequent restarts you need to configure it.

I found another related challenge, if you have multiple device_trackers (zone/person) it is impossible to identify which local_stop belongs to what. I will add the device track id in a next release so one can filter on it.

EDIT: done in latest release

1 Like

Your integration works great for my local bus transport :slight_smile:

Thanks for the feedback, can you please send me the link to the gtfs so I can extend the list of working sources?

I replied/linked it in HACF forum in French :slight_smile:

Hi everybody and many thanks to @vingerha to create this integration.
I´m currently testing this in Prague, GTFS works great, but I found weird behaviour of real time possition of buses:
I create sensor of buses from bus station Letnany to my home, add real time + RT possition and it creates JSON file in GTFS2 folder with GPS coordinates as expected. Then I created the same but in the opposite route with the same RT+RT possitions, second JSON file was created, but it contains only this: {"features": [], "type": "FeatureCollection"}

Any suggestion? Thanks.

The only reason I know of: data is not provided by the transport co. … join the club of many others with the same inconsistent/infrequent behavior.
EDIT; if you can ‘prove’ that you have data for the opposite direction then I can have a look, tillnow I spent many hours on this one xyz-ing the data-provider(s)

Ok, how can I ‘prove’ it? BTW, its no big deal for me to not have buses on map, I just want to share with you that this integration is mostly working in Prague.