External integration - Public transit (GTFS)

Hi everyone!

After Tisséo for Toulouse, several people have networks that don’t have their own dedicated integration. Instead of creating one per city, here’s Public Transport (GTFS): the next arrivals at your stops and disruptions for any network published on transport.data.gouv.fr. TER and TGV SNCF, Naolib, STAR, TaM, M, Ilévia, Stan… around 490 networks, 220 of which have real-time data. Everything comes from open data: no account and no key required.

What it does

  • The network is selected in Gladys: search in the national catalog, or enter the address of a GTFS file for a network not listed there. Up to 3 networks.
  • One device per stop (up to 20): for each line and direction, the minutes until the next arrival and the following one, the next three arrivals in text, and traffic info. Real-time data is used when the network publishes it; a theoretical schedule is marked with « ≈ ».
  • A widget « Next Arrivals », a trigger « Disruption on a followed line » and an action that prepares a message ready to send.

The cool part

At 7:45 AM on weekdays → the message with the next arrivals at my stop on Telegram
Disruption on my TER line → message on my phone before leaving
Bus in less than 4 minutes → the entrance light flashes

Installation

Gladys 5.1 minimum.

It will be available in the store at the next indexer update. In the meantime: Integrations → Install from GitHub, with the address GitHub - guim31/gladys-gtfs: Next departures and disruptions for any French public transport network (GTFS / GTFS-RT from transport.data.gouv.fr) in Gladys Assistant · GitHub

  1. In Configuration: search for your network, add it, then search for and add your stops (by name or around your home).
  2. Create the devices from the Discovery tab, then add the widget.

For Toulouse, Lyon, Île-de-France, and Bordeaux, the dedicated integrations (Tisséo, TCL, IDFM, TBM) remain more complete: the documentation mentions them. Île-de-France is actually too large for this one.

Honest caveats: real-time data depends on what each network publishes, and it can be heavy (up to around 100 MB per hour and per network with a refresh every minute; at night, a read every 15 minutes). It has been tested on real data (SNCF at Nantes station, Naolib, Aix-Marseille) under Gladys’ sandbox conditions, with a peak at 138 MB of memory, but not yet in a real instance.

Coded with the help of Claude Code, based on the code of my Tisséo integration. Independent project, not affiliated with transport.data.gouv.fr or the networks.

Repository: GitHub - guim31/gladys-gtfs: Next departures and disruptions for any French public transport network (GTFS / GTFS-RT from transport.data.gouv.fr) in Gladys Assistant · GitHub

Let me know which network you try it on :slight_smile:

Hey @guim31 you little rascal :joy:

What about worldwide? :

My load test from today… and since I have grown fond of Toulouse in the last few days, I went to 64 Boulevard Pierre Semard Toulouse, better known as Matabiau, for testing.

And here the same result for Heidelberg Hauptbahnhof:

Everything included, urban buses (BUS), interregional bus lines (COACH), urban trams (TRAM), interregional trains (FERN), local commuter trains (S-BAHN).

Ferries (FÄHRE) are also displayed, here the example of the Elbphilharmonie in Hamburg:

and after someone here pointed out to me that there might also be cable cars or similar:

Here is the city of Heidelberg with a funicular/cable car (FUNICULAR):

and what about our North American friends, here Quebec in Canada:

1.) Only internet access required

2.) No downloads

3.) Update controllable

4.) Radius controllable

5.) Location by geodata, planned: city name

If everything goes well, then I will be done with the tests today and then I will, as an absolute beginner in GitHub, briefly familiarize myself with creating an external integration or simply hand over the project to someone who masters it…

Greetings

Tom

I just found out that the real-time data for the Ginko network in Besançon is on this opendata platform. I’m going to test your integration, and if it works, it’ll be another Node-RED hack I can get rid of!

So actually, the integration does find the Ginko network in Besançon, but it’s only the theoretical schedules in GTFS format.
Real-time schedules are mentioned on the transport.data.gouv.fr website, but in SIRI format. The details explain that it goes through an API requiring a key.

On the website, there’s this:

And the details of the SIRI interface are here: Jeu de données ouvert SIRI - API SIRI pour Réseau urbain Ginko - CU Grand Besançon Métropole

I have such a key, that’s how I make my node-red tinkering work.
Do you think, @guim31, that you could complete your integration with this format?

@StephaneB well spotted, and yes it’s doable. I checked: Ginko isn’t alone in this case, around twenty networks publish their real-time data only in SIRI on transport.data.gouv.fr (Strasbourg, Pays de la Loire, Idelis, TUB…). I’ll get to it: an optional field for the network key, and the integration will fetch the SIRI stops when there’s no GTFS-RT. Your stops remain the same, nothing to recreate. I’ll let you know as soon as it’s ready, and your Node-RED tinkering will be the perfect test ^^

@ruegerth nice load test :smiley: Which source are you using to get Germany, Hamburg, and Quebec without downloading anything? If it’s an open global API, I’m interested, whether to complement this one or for your own integration.

@StephaneB it’s online: the 1.1.0 reads the real-time SIRI and SIRI Lite of networks that don’t have GTFS-RT, including Ginko.

To activate it: in the integration configuration, field « SIRI API Keys », add a line Ginko = your-key. The key never appears in the logs. Your stops remain the same: followed trips are displayed without the « ≈ » when they are in real-time, and Ginko disruptions feed the traffic info and the trigger.

I was able to test from my home against the real servers: Ginko responds well, but with no stops when you don’t have a key, so you’re going to make the first real test ^^ If the integration reports an unknown stop or a rejected key, let me know.

By the way, it also works for about fifteen other networks in the same situation: Pays de la Loire (Aléop and the urban networks of the aggregate), Saint-Brieuc (TUB), several networks in Nouvelle-Aquitaine (Tanlib, Calibus, R’Bus, TuT…), Strasbourg with a CTS key… Small reservation: the Okina platform, behind many of these networks, only accepts one request every 30 seconds or so. It’s better to follow one or two stops there, not ten.

@Guim31: Look here :joy:

Best regards

For everyone:

Besançon gives me:

Note: I am already working on an object Object. The following settings were used:

47.242222°, 6.021389°

Regards

Tom