Skip to main content

Rhein-Main Transit (RMV data) smart home integration, free and open source

Rhein-Main Transit (RMV data) integration for Gladys Assistant

Unofficial. Next departures and disruptions at your Rhein-Main stops. Data source: RMV.

The next departures (S-Bahn, U-Bahn, tram, bus, regional trains) at up to four stops of the Rhein-Main-Verkehrsverbund area (Frankfurt, Wiesbaden, Darmstadt, Mainz and the rest of Hesse served by the RMV), and the disruption messages the RMV attaches to them, in Gladys. Data source: RMV (Rhein-Main-Verkehrsverbund GmbH).

This integration is unofficial: it is not affiliated with, endorsed nor sponsored by the Rhein-Main-Verkehrsverbund, and it is not an official source. Check rmv.de or the station displays before you travel. It was never tested with a real key nor on a real Gladys installation by its author: the RMV API was simulated from its published schema (rest-2.39.xsd) and from the error answers it gives without a valid key.

Get started​

  1. Ask for your personal access key on the RMV Open Data page (form, with the intended use, e.g. "home automation, departures at my stops"). The key is free, personal and revocable; the RMV may refuse it. Read its terms of use (German): among others, the key must never be passed on to anyone, the data serve passenger information only, and a key unused for 180 days is deleted. By asking for your key, you accept these terms: their obligations (use, quotas, naming the source, the test version the RMV asks for, etc.) are yours, as the holder of the key (§4 c: one access per user).
  2. Find the stop ids. An RMV stop id has 6 to 9 digits (e.g. 3000010 for Frankfurt (Main) Hauptbahnhof). It appears in the address of a stop page of rmv.de, and the location search of the API (location.name) gives it.
  3. Install the integration, type the key and the ids in its configuration, and save. Open the Discover tab and press Add on each stop. Its name becomes the RMV name ("Frankfurt (Main) Hauptbahnhof tief (departures)") after the first read, unless you typed one.

One device per stop. A device belongs to a slot and its id: if you type another id in a slot, the integration offers a new device; the old one is no longer updated and keeps its last values (the configuration page lists it under "Not updated any more": delete it in Gladys). Changing the line filter keeps the device. The filter takes lines as the RMV names them, comma separated: S8, U4, 51 (a bus line matches by its number or by its name "Bus 51").

What each device shows​

FeatureTypeContent
Next departuretext"S8 → Wiesbaden Hauptbahnhof in 5 min (08:19, +1 min, track 103)"; "now" when it leaves; "timetable, no real-time data" when the RMV has no live time
Following departuretextthe same for the next one
Departures (30 min)counterfor scenes, e.g. "more than 0"
Departurestext"08:14 · S8 → Wiesbaden Hauptbahnhof 5, 20 min · U4 → Enkheim 11 min · 1 cancelled"
Disruptionscounterthe active disruption messages of the stop and of its departures (after the line filter)
Disruptiontextthe most important message (lowest RMV priority) and how many more

The times are Frankfurt times, the real-time ones when the RMV has them. Every read publishes every value: a departure that is gone becomes "No following departure (read 08:16)", never a number left behind. A cancelled departure is not a departure: it is counted apart in the summary. A failed, stale or unreadable read publishes nothing (no 0): the configuration page says why and since when. When the real-time data of the RMV has not changed for 15 minutes (planRtTs), or when that stamp is there but cannot be read, nothing is published either (without any stamp, nothing proves the feed is old: the board is published).

The scene trigger New RMV disruption at a stop fires once for a message seen for the first time at a watched stop, when it started or changed within the last 24 hours (the first read only learns the messages already there; 10 events per read at most).

Requests and quotas​

  • One request per stop and per read (the disruption messages come in the same answer), one at a time, 2 s apart at least. Read interval: 120 s by default (60 to 900).
  • The terms of use of the RMV allow 600 requests an hour and 5,000 a day per key. The integration keeps a daily budget (4,000 by default, 5,000 at most, setting "Daily budget", for the case where the same key serves something else) and a cap of 540 requests per clock hour. It counts the requests of the Berlin day and hour, writes the counts to /data before each request (a restart keeps them), and stretches the read interval when the planned reads would not fit 90 % of the budget (the status says "Reads every N s"). Four stops at 120 s use 2,880 requests a day.
  • Reading window (optional, settings "Read from" and "Read until", Berlin time, HH:MM): the terms of the RMV ask for timetable information "on request" (§4 e). Outside the window no request is sent; the devices keep their last values with the time of their read, and the status says "Outside the reading window". A read leaves as soon as the window opens (never less than one interval after the previous one). End excluded; a window may pass midnight (22:00 to 01:00); both empty: all day; only one set, an invalid time or two equal times: refused, named in the status, reads all day. The clock changes follow Berlin time (a window starting in the hour skipped in spring opens one hour later that day). With a window, the daily budget is spread over its length only (plus one hour for the days of clock change).
  • If the RMV says the quota of the key is spent (API_QUOTA), the reads pause one hour, then two, up to 6 hours. A 429, a server error or an unexpected answer pauses the reads from 1 or 2 minutes, doubled up to 6 hours.
  • If the RMV refuses the key (API_AUTH with HTTP 401 or 403, or in its answer), nothing is sent with it any more, even after a restart, until you type another key or press Show the last read / retry the key, which sends one request with it (60 s at least after the previous one). A success lifts the refusal. Any other HTTP 401 or 403 is not taken as a refusal: it pauses the reads.
  • An unknown stop id (SVC_LOC) is said on the configuration page and asked again after 30 minutes; the other stops go on.
  • A restart, a reconnection, a saved configuration that did not change and Discovery never read sooner than the interval. The button reads only to retry a refused key, as said above, also outside the reading window.

Your key​

The key is kept by Gladys in its database, never shown again, and sent only to the RMV (in the address of each request, as the API requires). The integration never writes it to its logs, its status nor /data; the error text of the RMV, which repeats the key, is never kept nor shown. It keeps in /data two salted 8-bit prints of a refused key (65,536 possible values, shared by countless keys), enough to know "another key" after a restart, and a salted 8-bit print of the key beside the request counts (256 possible values), to start them again for another key.

Troubleshooting​

The message at the top of the configuration page tells where each stop stands and how many requests the key used today. Common messages:

  • "The RMV does not know this stop id": check the id; asked again after 30 minutes.
  • "No departure has confirmed this stop id yet": the board is empty and no departure was ever seen there; nothing is published until one is.
  • "Differs from the clock of this machine": set the clock of the machine that runs Gladys.

Terms of use​

The data is used under the terms of use of the RMV-Auskunft-API (Rhein-Main-Verkehrsverbund GmbH): free of charge, revocable at any time, without warranty, for passenger information only, through each user's own key from their own Gladys. Each user holds their own key: by asking for it, they accept the RMV Open Data terms, and their obligations are theirs. Data source: RMV (a text mention; no logo of the RMV is used).

Configuration settings​

These are the settings Rhein-Main Transit (RMV data) asks for in its configuration screen in Gladys.

SettingTypeRequiredDescription
Rhein-Main trains and busessectionNoUnofficial, not affiliated with the Rhein-Main-Verkehrsverbund. Data source: RMV (Rhein-Main-Verkehrsverbund GmbH). The next departures (S-Bahn, U-Bahn, tram, bus, regional trains) at up to four stops of the RMV area, and the disruption messages the RMV attaches to them. It needs a free personal access key to the RMV API, asked on the RMV Open Data page (the RMV may refuse or revoke it). The terms of the RMV allow 600 requests an hour and 5000 a day per key: the integration counts its requests and stays within the daily budget below.
RMV access keysecretNoYour personal access key to the RMV API (accessId), kept by Gladys in its database, never shown again, sent only to the RMV. The terms of the RMV forbid passing it on to anyone.
Language of the textsselectNoThe language of the device names and the departure texts.
Language of the RMV textsselectNoThe language asked of the RMV for its own texts (stop names, disruption messages). Some messages exist in German only.
Read interval (s)numberNoHow often the departures are read, in seconds (60 to 900). One request per stop and per read. Stretched when the daily budget would not hold it.
Daily budget (requests)numberNoRequests per Berlin day at most (200 to 5000; the RMV allows 5000 a day and 600 an hour per key, and the same key may serve another application). Each stop costs one request per read.
Read from (optional)stringNoReading window, Berlin time (HH:MM): outside it, no request is sent and the devices keep their last values with the time of their read. Read at once when the window opens. Both empty: all day. A window may pass midnight (e.g. 22:00 to 01:00).
Read until (optional)stringNoEnd of the reading window, Berlin time (HH:MM), excluded.
Stop 1sectionNoThe RMV id of a stop (6 to 9 digits, e.g. 3000010 for Frankfurt (Main) Hauptbahnhof): shown in the address of the stop page of rmv.de, or asked with the location search of the RMV API.
Name (optional)stringNo
RMV stop idstringNo
Lines (optional)stringNoOnly these lines, comma separated (e.g. S8, U4, 51). Empty: every line.
Stop 2sectionNo
Name (optional)stringNo
RMV stop idstringNo
Lines (optional)stringNoOnly these lines, comma separated (e.g. S8, U4, 51). Empty: every line.
Stop 3sectionNo
Name (optional)stringNo
RMV stop idstringNo
Lines (optional)stringNoOnly these lines, comma separated (e.g. S8, U4, 51). Empty: every line.
Stop 4sectionNo
Name (optional)stringNo
RMV stop idstringNo
Lines (optional)stringNoOnly these lines, comma separated (e.g. S8, U4, 51). Empty: every line.

How to install Rhein-Main Transit (RMV data) in Gladys​

  1. In Gladys, open Integrations: Rhein-Main Transit (RMV data) appears in the catalog, next to the native integrations, with a community badge.
  2. Click Install. Gladys pulls the Docker image (ghcr.io/lm1lc3n7/gladys-rhein-main-transit:0.1.1), starts it in a sandbox isolated from the core, and generates the integration's interface (devices, discovery and configuration).
  3. Open the Configuration screen of the integration, fill in the settings, and save.
  4. You can also install it directly from its repository URL: https://github.com/LM1LC3N7/gladys-rhein-main-transit.

Rhein-Main Transit (RMV data) requires Gladys >=5.3.0. The catalog inside Gladys refreshes every hour, so a new version becomes available at most one hour after its release.

Not running Gladys yet? It is free and open source: follow the installation guide to get started.

About external integrations​

Rhein-Main Transit (RMV data) is an external integration: a community integration packaged as a Docker container and published on GitHub, that Gladys installs in one click and runs in a sandbox isolated from its core. It is published and maintained by LM1LC3N7, not by the Gladys core team.

Subscribe to the Gladys Assistant newsletter

A few emails per month about new releases and project news. Sent by Pierre-Gilles Leymarie, founder of the project. Unsubscribe anytime 🙂