GTFS for Public Transport revamped

Yeah…hence I added the ‘’ around thw word : prove…it is not easy unless the provider themselves shows a map with the location in realtime…usually they have none.
Note that I have seen other examples where the location is not consistent too. For some trajectories/routes it works, for others none.
If you want I can have a quick look too but then please open a ticket here with all the details of your setup, quick as in: it is impossible for me to analyse all the datasources in my ‘private’ time

New Issue · vingerha/gtfs2 (github.com)

Hello,

Vienna, Austria (Wiener Linien) and the federal railway (ÖBB or OEBB) is also working with the integration. Thank you very much

Thx…can you please send me the URL from where you took the data? So I can update this one

Home · vingerha/gtfs2 Wiki (github.com)

Vienna
data: http://www.wienerlinien.at/ogd_realtime/doku/ogd/gtfs/gtfs.zip

OEBB:
data: https://static.oebb.at/open-data/soll-fahrplan-gtfs/GTFS_OP_2024_obb.zip

1 Like

Vienna

OEBB:

Does anyone have an example how to filter in the flex-table-card card for a specific attribute (route, stop or headsign? also multiple) I unfortunately can not work it out for myself. Thanks

I spent again a bit of time but cannot get this to work either.
So, I made a simple workaround via an input_text (for the route) and a markdown-card. This should be fine as an example to filter other ways. See last card

5. Visualizing the data · vingerha/gtfs2 Wiki (github.com)

1 Like

I managed to make a flex card for every stop in my vicinity, which is ok and I don’t need a filter right away any more.

Next Step would be to have a countdown instead of the departure time. Any idea to that?
I managed to make a template that calculates it but I cannot integrate it in the Flex-card and dont want to make a sensor for every departure. Anyone can help?

{% set departure_time = state_attr('sensor.local_stop_zone','next_departures_lines')[0].departure %}
{% if departure_time != 'unknown' %}
    {% set departure_time_components = departure_time.split(':') %}
    {% set departure_time = now().replace(hour=departure_time_components[0] | int, minute=departure_time_components[1] | int, second=departure_time_components[2] | int) %}
    {% set countdown = (departure_time - now()).total_seconds() / 60 %}
    {% if countdown > 0.51 %}
        {{ countdown | round(0) }} Minuten
        {% else %}
        Now   
    {% endif %}
{% else %}
        Departure time unavailable
{% endif %}

Something like this…screenshot was at 13:01

1 Like

I seem to be having issues all of a sudden with the entities either not working at all or saying ‘unknown’ once I reconfigure them. They had been working for months since setting this up. Any ideas? Anyone experiencing anything similiar?

Likely your datasource expired, did you update that? (see documentation on seting up a service call …automated)

I’ve read the service call section but I am a bit confused how to achieve this, would you mind walking me through it? Sorry. Is it something to do with this zip file I extracted as per the initial set of instructions

I will not pretend that my documentation is easy …am not a writer, but what is unclear from the first picture? When you tested that, you can use create an automation running this service all (bi)weekly
4. Service call · vingerha/gtfs2 Wiki (github.com)

No it is very clear, I am just not very skilled! haha. This is what I have done, and this is the result, is this right? It doesn’t seem to have changed them but maybe it is still downloading something?

Depending on the size of the file this can take anywhere between 15 mins and 3 hours. You can check config/gtfs2 folder if it contains a *.sqlite-journal file.
Note that I would not give this such a long name, just ‘tseq’ looks fine already …unless you have dozens of these that all differ and you need to distinguish


I do have that sqlite file as above. So perhaps just wait now and it should update? And I should do this call service every couple of weeks?

It took about 30mins with me, might be stuck on the name…again… try a simpel not-too-long name

This is what I am getting now - So I am clearly doing something wrong, any ideas?

I think I got it working again! It doesn’t seem to like or need me to put in the real time data. Thanks for all your help!! I will use that call service again if it stops working next time :slight_smile:

Hello. First of all thank you so much for this awesome custom plugin. I really hope that GTFS will become a standard that every country with public transport will offer to their citizens.
I found a very nice block of code that gave me the following table:

With this code:

type: vertical-stack
cards:
  - type: custom:mushroom-title-card
    title: Public Transport
    subtitle: Departures <1h
  - type: custom:auto-entities
    filter:
      include:
        - name: '*_local_stop_*'
      exclude:
        - state: unavailable
    card:
      type: custom:flex-table-card
      clickable: true
      max_ rows: 30
      sort_by:
        - next_departures_lines
      columns:
        - hidden: true
          data: next_departures_lines
          modify: x.departure
        - name: Route
          data: next_departures_lines
          modify: '''<ha-icon icon='' + x.icon + ''></ha-icon>'' + x.route'
        - name: Time
          data: next_departures_lines
          modify: x.departure
        - name: Stop
          data: next_departures_lines
          modify: x. stop_name
        - name: Direction
          data: next_departures_lines
          modify: x.headsign
        - name: Diff
          data: next_departures_lines
          modify: |
            var dept = new Date(x.date + ' ' +x.departure);
            var diff = dept - Date.now()
            Math.round (diff / 60 / 1000)

But the tinkerer in me wants a table with only train departures. I figured that it would be easy to filter out (exclude) the busses. I checked Thomas Lovens lovelace-auto-entities for filtering by attribute. In this case icon: mdi:bus. But that didn’t work. After a few hours and having tried many code variations I gave up. Any tips on what does work?