[External integration] SNCF: your trains in real-time in Gladys 🚆

Hello everyone,

I’m introducing a new external integration: SNCF. It tracks your upcoming trains (home → work, return trip, etc.) in real-time, including delays, cancellations, and their reason.

What it offers

  • Up to 3 trips, with optional time slots and days (e.g., 07:00-09:30, Monday to Friday). In the evening, it already tracks the next morning’s trains.
  • One device per trip: next train (« 07:42 · TER 858311 · +5 min »), delay of the next train in minutes, number of disrupted trains. Ideal for history and scene values.
  • 3 scene triggers:
    • Train delayed (filter by level: less than 15 min, 15-29, 30 and more)
    • Train cancelled (or no longer serving your station)
    • Imminent departure: 5 to 60 min before departure, calculated based on real time (including delays). Perfect for a « leave now » on the speaker!
  • 1 scene action « Next trains », with a ready-made sentence: « Rennes → Nantes: TER 858311 at 07:42 has a 5-minute delay, departure at 07:47. Next: 08:12 on time. »
  • 2 widgets: the trains of a trip (badges on time / +N min / cancelled, reason on touch) and the departure board of a station.

What you need

A free SNCF API key: a form on Demandez votre clé d'accès gratuite - SNCF NUMÉRIQUE, the key arrives by email. It provides 5,000 requests per day. The integration counts them itself and slows down before the limit (approximately 250 requests per day for a trip with a time slot).

Good to know

  • Only direct trains are tracked.
  • Transilien: theoretical schedules only (SNCF API limitation).
  • The track is not provided by the official API.
  • A cancelled train disappears from SNCF’s real-time data. The integration detects it by comparing with theoretical schedules, then confirms it on the departure board, to never announce a cancellation incorrectly.

Installation

From the Gladys integrations store (Gladys 5.1.1 minimum), then:

  1. paste your API key;
  2. enter your stations (name, UIC code, or « Search for a station » button);
  3. click on « Test connection »;
  4. add devices from the Discovery tab.

Documentation: gladys-sncf/docs/fr.md at main · William-De71/gladys-sncf · GitHub
Source code: GitHub - William-De71/gladys-sncf: External Gladys Assistant integration for SNCF trains: next departures of your trips in real time, delays, cancellations, scenes and dashboard widgets. · GitHub

This is a community integration, with no connection to SNCF. Your feedback is welcome.

1 Like