From a9ed1b6fb438fb9b75a50db6069fe49d399ea471 Mon Sep 17 00:00:00 2001 From: Honey Date: Wed, 22 Jul 2026 21:45:18 +0200 Subject: [PATCH] Clarify Departures covers bus/tram/subway too, add clear found/not-found feedback The API (HAFAS via db-vendo-client) covers all public transport in one system, not just trains -- verified with a mocked bus-stop response (Bus 14/Bus 9/Bus 66 mixed with a regional train, all rendering correctly, no code changes needed since nothing in check()/render() ever filtered by mode). Fixed the "Train departures" wording in code comments and settings UI, which was misleadingly train-specific. Also added an explicit "Found: " confirmation toast on a successful station lookup, distinct from the generic "Saved." toast -- previously the only feedback was a passive "Currently: X" hint, easy to miss and not obviously tied to the save you just did. --- screens/departures.py | 9 +++++++-- web/app.py | 2 +- web/templates/settings_departures.html | 6 +++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/screens/departures.py b/screens/departures.py index d252c4f..78da91e 100644 --- a/screens/departures.py +++ b/screens/departures.py @@ -1,7 +1,12 @@ -"""Train departures via the free, unofficial db-vendo-client REST API -(v6.db.transport.rest) -- no API key needed, wraps Deutsche Bahn's own +"""Departure board via the free, unofficial db-vendo-client REST API +(v6.db.transport.rest) -- no API key needed, wraps Deutsche Bahn's HAFAS backend the same way a lot of hobby projects/Home Assistant integrations do. +Not train-only -- HAFAS covers regional/long-distance trains, S-Bahn, +U-Bahn/subway, trams, and buses in one system, so a bus stop works exactly +the same way as a train station here: search for it by name like any other +stop, nothing in check()/render() cares which mode a given departure is. + It's community-run on donated infrastructure, not an official DB service -- expect occasional downtime. check() degrades to None on any failure (via the same try/except pattern as the Navidrome screen), which renders a diff --git a/web/app.py b/web/app.py index 95ae00e..cc5ae6a 100644 --- a/web/app.py +++ b/web/app.py @@ -123,7 +123,7 @@ def create_app(config, screens: dict, scheduler) -> Flask: "results": results, "update_minutes": update_minutes, }) - return redirect(url_for("settings_departures", saved=1)) + return redirect(url_for("settings_departures", found=found["name"])) else: config.update_screen_settings("departures", {"results": results, "update_minutes": update_minutes}) return redirect(url_for("settings_departures", saved=1)) diff --git a/web/templates/settings_departures.html b/web/templates/settings_departures.html index b03e034..6988bad 100644 --- a/web/templates/settings_departures.html +++ b/web/templates/settings_departures.html @@ -5,6 +5,9 @@ {% if error %}
{{ error }}
{% endif %} +{% if request.args.get('found') %} +
Found: {{ request.args.get('found') }}
+{% endif %}

Uses the free, unofficial db-vendo-client API (v6.db.transport.rest) -- @@ -17,8 +20,9 @@

- + +

Works for bus/tram/subway stops too, not just train stations -- search by name the same way either way.

{% if settings.station_label %}

Currently: {{ settings.station_label }}

{% endif %}