{"id":24465604,"url":"https://github.com/faserf/ha-db_infoscreen","last_synced_at":"2026-02-23T13:20:41.756Z","repository":{"id":273447107,"uuid":"919736981","full_name":"FaserF/ha-db_infoscreen","owner":"FaserF","description":"db-infoscreen Homeassistant fetching (superior of ha-deutschebahn)","archived":false,"fork":false,"pushed_at":"2025-03-29T11:18:06.000Z","size":1610,"stargazers_count":54,"open_issues_count":9,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-06T22:47:55.193Z","etag":null,"topics":["deutsche-bahn","ha-deutschebahn","hacs-integration","homeassistant","train"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FaserF.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"faserf","custom":"https://paypal.me/FaserF"}},"created_at":"2025-01-20T23:09:57.000Z","updated_at":"2025-05-05T06:40:48.000Z","dependencies_parsed_at":"2025-02-09T12:21:22.964Z","dependency_job_id":"9f7d87d9-05fa-4bf5-9b4c-d4e64a760574","html_url":"https://github.com/FaserF/ha-db_infoscreen","commit_stats":null,"previous_names":["faserf/ha-db_infoscreen"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FaserF%2Fha-db_infoscreen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FaserF%2Fha-db_infoscreen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FaserF%2Fha-db_infoscreen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FaserF%2Fha-db_infoscreen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FaserF","download_url":"https://codeload.github.com/FaserF/ha-db_infoscreen/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252782459,"owners_count":21803380,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deutsche-bahn","ha-deutschebahn","hacs-integration","homeassistant","train"],"created_at":"2025-01-21T06:12:15.380Z","updated_at":"2026-02-23T13:20:41.708Z","avatar_url":"https://github.com/FaserF.png","language":"Python","funding_links":["https://github.com/sponsors/faserf","https://paypal.me/FaserF"],"categories":[],"sub_categories":[],"readme":"[![hacs_badge](https://img.shields.io/badge/HACS-CUSTOM-41BDF5.svg?style=for-the-badge)](https://github.com/hacs/integration)\n\n# db-infoscreen Homeassistant Sensor\nThe `db-infoscreen` sensor will give you the departure time of the next trains for the given station, containing many more attribute informations. It aims to aggregate departure and train data from different sources and combine them in a useful (and user-friendly) manner. It is intended both for a quick glance at the departure board and for public transportation geeks looking for details about specific trains.\nThe backend has many datasources available with it's main source being IRIS-TTS - Deutsche Bahn.\n\n\u003cdel\u003eThis integration works great side-by-side with [ha-bahnvorhersage](https://github.com/FaserF/ha-bahnvorhersage).\u003c/del\u003e\nThis is a superior to [ha-deutschebahn](https://github.com/FaserF/ha-deutschebahn).\n\n\u003cimg src=\"images/logo.png\" alt=\"Logo\" width=\"300px\"\u003e\n\n\u003cimg src=\"images/sensor.png\" alt=\"Station Sensor\" width=\"300px\"\u003e\n\n## Installation\n### 1. Using HACS (recommended way)\n\nThis integration is NO official HACS Integration right now.\n\nOpen HACS then install the \"db-infoscreen\" integration or use the link below.\n\n[![Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.](https://my.home-assistant.io/badges/hacs_repository.svg)](https://my.home-assistant.io/redirect/hacs_repository/?owner=FaserF\u0026repository=ha-db_infoscreen\u0026category=integration)\n\nIf you use this method, your component will always update to the latest version.\n\n### 2. Manual\n\n- Download the latest zip release from [here](https://github.com/FaserF/ha-db_infoscreen/releases/latest)\n- Extract the zip file\n- Copy the folder \"db_infoscreen\" from within custom_components with all of its components to `\u003cconfig\u003e/custom_components/`\n\nwhere `\u003cconfig\u003e` is your Home Assistant configuration directory.\n\n\u003e__NOTE__: Do not download the file by using the link above directly, the status in the \"master\" branch can be in development and therefore is maybe not working.\n\n## Configuration\n\nGo to Configuration -\u003e Integrations and click on \"add integration\". Then search for \"db-infoscreen\".\n\n[![Open your Home Assistant instance and start setting up a new integration.](https://my.home-assistant.io/badges/config_flow_start.svg)](https://my.home-assistant.io/redirect/config_flow_start/?domain=db_infoscreen)\n\nYou can set up one sensor per station, except using different `via_stations` configurations.\n\n### Configuration Variables\n\n| Key                      | Type    | Required | Default | Description |\n|--------------------------|---------|----------|---------|-------------|\n| `station`               | string  | Yes      | -       | The name of the station or Trip number to be tracked. |\n| `next_departures`       | int     | No       | 4       | Number of upcoming departures to display. Please note that there may be displayed less than your number, due to [storage limitations](https://github.com/FaserF/ha-db_infoscreen/issues/22). |\n| `update_interval`       | int     | No       | 3       | Time interval (in minutes) to fetch updated departure data. Minimum: 1 minute. |\n| `hide_low_delay`        | boolean | No       | False   | Hide departures with a delay of less than 5 minutes. |\n| `drop_late_trains`      | boolean | No       | False   | Hide past departures that would still be delayed. |\n| `detailed`             | boolean | No       | False   | Show additional details about departures. |\n| `past_60_minutes`      | boolean | No       | False   | Show departures from the past 60 minutes. |\n| `keep_route`           | boolean | No       | False   | Keep route (stopover) details (all train stations on train route). |\n| `keep_endstation`      | boolean | No       | False   | Keep departure if station is also endstation. |\n| `custom_api_url`       | string  | No       | -       | Use a custom API URL instead of the default one. |\n| `data_source`          | string  | No       | IRIS-TTS | Choose the data source for fetching departure information. More details can be found below at Data Sources. |\n| `offset`              | string  | No       | 00:00   | Time offset for departure search (HH:MM or HH:MM:SS). |\n| `admode`              | string  | No       | departure preferred | Defines whether to display departure or arrival times. |\n| `platforms`           | string  | No       | -       | Filter by specific platform(s) (comma-separated). |\n| `via_stations`        | string  | No       | -       | Filter by stations where the train must pass through. |\n| `ignored_train_types` | list    | No       | []      | List of train types to ignore (may not work for all data sources, e.g., VMT). |\n\n#### Warnings and Limitations\n\n- **Sensor limits:** You are limited to adding 30 sensors, if you are not using a custom_api_url. This is due to backend limitations, see [here](https://dbf.finalrewind.org/) under \"API\".\n- **Storage Limitations:** Certain configurations (e.g., `detailed`, `keep_route`, or many `next_departures`) may quickly lead to reaching storage limitations. See [issue #22](https://github.com/FaserF/ha-db_infoscreen/issues/22) for details.\n- **Data Accuracy:** The accuracy of the departure information depends on the selected `data_source`. Some sources may provide outdated or incomplete data.\n- **Update Interval:** The minimum `update_interval` is 1 minute. A lower interval may cause high API usage and lead to throttling or bans. This is due to backend limitations, see [here](https://dbf.finalrewind.org/) under \"API\".\n- **Custom API URL:** If using `custom_api_url`, ensure that the API follows the expected response format to avoid errors.\n\n\n#### Data Sources\nSupported are only available [Backend Sources from DBF](https://dbf.finalrewind.org/_backend). There is no way for me to support other sources than that. The mentioned sources there are all using HAFAS or EFA. If you are missing a source that uses HAFAS or EFA, you can create a feature request at [a db-infoscreen - (formerly db-fakedisplay)](https://github.com/derf/db-fakedisplay/tree/main).\n\n\n- **data_source** (optional): Choose the data source for fetching departure information. The available options are:\n  - The integration supports fetching departure data from various data sources, including:\n    - IRIS-TTS – Deutsche Bahn (default and used by most)\n    - AVV – Aachener Verkehrsverbund Nordrhein-Westfalen (avv.de)\n    - BART – Bay Area Rapid Transit California (bart.gov)\n    - BLS – BLS AG Kanton Bern, Kanton Luzern (bls.ch)\n    - BVG – Berliner Verkehrsbetriebe Berlin, Brandenburg (bvg.de)\n    - BSVG – Braunschweiger Verkehrs-GmbH\n    - bwegt - Personennahverkehr in Baden-Württemberg (ehem. 3-Löwen-Takt)\n    - CMTA – Capital Metro Austin Public Transport Texas (capmetro.org)\n    - DING – Donau-Iller Nahverkehrsverbund\n    - DSB – Rejseplanen Dänemark (rejseplanen.dk)\n    - IE – Iarnród Éireann Irland, Nordirland (irishrail.ie)\n    - KVV – Karlsruher Verkehrsverbund Baden-Württemberg\n    - KVB – Kölner Verkehrs-Betriebe (kvb.koeln)\n    - LinzAG – Linz AG\n    - mobiliteit – mobilitéits zentral Luxembourg (mobiliteit.lu)\n    - MVV – Münchener Verkehrs- und Tarifverbund Bayern\n    - NAHSH – Nahverkehrsverbund Schleswig-Holstein Schleswig-Holstein (nah.sh)\n    - NASA – Personennahverkehr in Sachsen-Anhalt Sachsen-Anhalt (nasa.de)\n    - NVBW – Nahverkehrsgesellschaft Baden-Württemberg\n    - NVV – Nordhessischer Verkehrsverbund Hessen (nvv.de)\n    - NWL – Nahverkehr Westfalen-Lippe\n    - ÖBB – Österreichische Bundesbahnen Österreich\n    - PKP - Polskie Koleje Państwowe PL (polnische Staatsbahn)\n    - Resrobot – Resrobot\n    - RMV – Rhein-Main-Verkehrsverbund Hessen, Baden-Württemberg, Bayern, Rheinland-Pfalz (rmv.de)\n    - RSAG – Rostocker Straßenbahn Mecklenburg-Vorpommern (rsag-online.de)\n    - SaarVV – Saarländischer Verkehrsverbund DE-SL (saarvv.de)\n    - STV – Steirischer Verkehrsverbund AT-6 (verbundlinie.at)\n    - TPG – Transports publics genevois Kanton Genf (tpg.ch)\n    - VAG - Freiburger Verkehrs AG\n    - VBB – Verkehrsverbund Berlin-Brandenburg Berlin, Brandenburg (vbb.de)\n    - VBN – Verkehrsverbund Bremen/Niedersachsen Niedersachsen, Bremen (vbn.de)\n    - VGN – Verkehrsverbund Großraum Nürnberg Bayern\n    - VMT – Verkehrsverbund Mittelthüringen Thüringen (vmt-thueringen.de)\n    - VMV – Verkehrsgesellschaft Mecklenburg-Vorpommern Mecklenburg-Vorpommern\n    - VOS – Verkehrsgemeinschaft Osnabrück Niedersachsen (vos.info)\n    - VVO – Verkehrsverbund Oberelbe\n    - VVS – Verkehrs- und Tarifverbund Stuttgart Baden-Württemberg\n    - VRN – Verkehrsverbund Rhein-Neckar (Nordrhein-Westfalen) (EFA)\n    - VRN2 – Verkehrsverbund Rhein-Neckar (Rheinland-Pfalz, Hessen, Baden-Württemberg) (HAFAS)\n    - VRR – Verkehrsverbund Rhein-Ruhr Nordrhein-Westfalen\n    - VRR2 – Verkehrsverbund Rhein-Ruhr Nordrhein-Westfalen\n    - VRR3 – Verkehrsverbund Rhein-Ruhr Nordrhein-Westfalen\n    - ZVV – Züricher Verkehrsverbund Kanton Zürich (zvv.ch)\n  - Some stations can be searched via \"IRIS-TTS\" but need hafas=1 for data retrival, f.e. \"Frankenforst Kippekausen, Bergisch Gladbach\", choose `hafas=1` in the list to archive this. [GitHub issue about this](https://github.com/FaserF/ha-db_infoscreen/issues/8)\n\n#### Config changes after setup\nDue to a bug the option flow (option to change config flow settings after set up) has been removed for now. Once I got the issue fixed, it will be re-added. For now to change settings you need to remove the entry and then afterwards set it up again to change your settings.\n\n### Migrating from [ha-deutschebahn](https://github.com/FaserF/ha-deutschebahn)\n\nMigration from `ha-deutschebahn` to `ha-db_infoscreen` is not directly possible because the two integrations use different API sources and data structures. The old `ha-deutschebahn` API supported start and destination stations directly, which the new `ha-db_infoscreen` API cannot fully replicate. However, you can still achieve a similar experience with a few workarounds:\n\n#### Options to Achieve a \"Start to Destination\" Experience:\n\n1. **Use the `platforms` Parameter**\n   You can display only one direction by filtering for specific platforms. For example, show only trains from Munich to Augsburg, and then filter by specific end stations on the way.\n\n2. **Use Two Sensors**\n   To simulate a fixed start-to-destination route, create two sensors for the same station but with different `via_stations`. This will allow you to simulate the direction from the start station to the destination.\n\n---\n\n#### Example for Using `via_stations`\n\nIf you want to see trains departing from Munich Hbf to Augsburg Hbf, you can configure it as follows:\n\n```yaml\nsensor:\n  - platform: db_infoscreen\n    station: \"München Hbf\"\n    next_departures: 4\n    via_stations: \"Augsburg Hbf\"\n    platforms: \"5,6\"\n```\n\nThis configuration will display only the relevant departures from Munich to Augsburg, excluding the return trips.\n\n---\n\n#### Key Options for \"Start to Destination\" (Migration)\n\n- **Platform Filter (`platforms`)**:\n  Use this parameter to restrict departures to specific platforms. This can help narrow down the direction you want to track.\n\n- **Via Stations (`via_stations`)**:\n  To simulate a specific direction, use `via_stations` to filter trains passing through certain intermediate stations.\n\n- **Use Two Sensors**:\n  If you want to filter departures in a single direction (for example, from Munich to Augsburg), use two sensors with different `via_stations` configurations.\n\n---\n\n#### Further Information\n\nAll other features of the old `ha-deutschebahn` integration have been ported to `ha-db_infoscreen`. For further discussion, check out the [discussion on GitHub](https://github.com/FaserF/ha-db_infoscreen/issues/4).\nYou can also check out some examples in Accessing the data.\n\n\n## Accessing the data\n\n### Automations\n```yaml\nautomation:\n  - alias: Notify Train Delay\n    description: \"Notify when the next train is delayed by more than 10 minutes.\"\n    trigger:\n      - platform: template\n        value_template: \"{{ state_attr('sensor.station_departures', 'next_departures')[0]['delayArrival'] | int \u003e 10 }}\"\n    action:\n      - service: notify.notify\n        data:\n          message: \u003e\n            The next train to {{ state_attr('sensor.station_departures', 'next_departures')[0]['destination'] }}\n            is delayed by {{ state_attr('sensor.station_departures', 'next_departures')[0]['delayArrival'] }} minutes.\n    mode: single\n```\n\n### Custom sensor\nAdd a custom sensor in your configuration.yaml\n\n```yaml\nsensor:\n  - platform: template\n    sensors:\n      next_train_departure:\n        friendly_name: \"Next Train Departure\"\n        value_template: \u003e\n          {{ state_attr('sensor.station_departures', 'next_departures')[0]['scheduledArrival'] }}\n        icon_template: mdi:train\n```\n\n#### Community submit by [kRew94](https://github.com/kRew94) (Improved by [kaffeetrinker71](https://github.com/FaserF/ha-db_infoscreen/issues/4#issuecomment-2611684018))\nThis is a template sensor which gives the information for a destination in the format \"HH:MM +DELAY\":\n\n```yaml\n{%- set number = 0 -%}\n{%- set connections = state_attr('sensor.uelzen_departures_via_hannover_hbf', 'next_departures') | selectattr('isCancelled', 'equalto', 0) | list -%}\n{% if connections is not none and connections | length \u003e number %}\n  {% set connection = connections[number] %}\n  {% set product = connection.train %}\n  {% set departure = connection.scheduledDeparture %}\n  {% set delay = connection.delayDeparture | int %}\n  {{ product }} um {{ departure }}{% if delay \u003e 0 %} +{{ delay }}{% endif %}\n{% else %}\n  No data\n{% endif %}\n```\nThe result looks like this: \"ICE 2935 um 07:15\"\n\n### YAML Snippets\nThere are some examples that can be used within automations or custom sensors.\n\n#### Community submit by [Kanecaine](https://github.com/Kanecaine)\nI have a sensor for Berlin Central Station and would now like to know which connections there are to Leipzig and should give you the following output:\nIC 495 um 22:28 +1.\n\n[More informations](https://github.com/FaserF/ha-db_infoscreen/issues/4#issuecomment-2605743834).\n\n```yaml\n{%- set my_station = \"Berlin Hbf\" -%}\n{%- set target = \"Leipzig Hbf\" -%}\n{%- set number = 0 -%}\n{%- set connections = state_attr('sensor.berlin_hbf_departures', 'next_departures') | default([]) | selectattr('isCancelled', 'equalto', 0) -%}\n{%- set valid_connections = namespace(connections=[]) -%}\n{%- for connection in connections -%}\n  {%- set route = connection.route | default([]) | selectattr('name', 'defined') | map(attribute='name') | list -%}\n  {%- if my_station in route and target in route and route.index(target) \u003e route.index(my_station) -%}\n    {%- set valid_connections.connections = valid_connections.connections + [connection] -%}\n  {%- endif -%}\n{%- endfor -%}\n\n{%- if valid_connections.connections | length \u003e number -%}\n  {%- set connection = valid_connections.connections[number] -%}\n  {%- set product_raw = connection.train | default('Unknown') -%}\n  {%- set product = product_raw | regex_replace('^(Bus).*|^([A-Z]{2})\\\\s?\\\\d*', '\\\\1\\\\2') | replace(\"S \", \"S\") -%}\n  {%- set departure = connection.scheduledDeparture | default('--') -%}\n  {%- set delay = connection.delayDeparture | default(0) | int -%}\n  {{ product }} {{ departure }}{% if delay \u003e 0 %} +{{ delay }}{% endif %}\n{%- else -%}\n  --\n{%- endif -%}\n```\n\n### JSON Format\nThe API returns data in the following json format usually:\n\n```json\n{\n  \"departures\": [\n    {\n      \"scheduledArrival\": \"08:08\",\n      \"destination\": \"München-Pasing\",\n      \"train\": \"S 4\",\n      \"platform\": \"4\",\n      \"delayArrival\": 18,\n      \"messages\": {\n        \"delay\": [\n          {\"text\": \"delay of a train ahead\", \"timestamp\": \"2025-01-21T07:53:00\"}\n        ]\n      }\n    }\n  ]\n}\n```\n\nThere are some differences depending on the stations, for example:\n```json\n{\n  \"departures\": [\n    {\n      \"delay\": 0,\n      \"destination\": \"Bensberg, Bergisch Gladbach\",\n      \"direction\": \"Bensberg, Bergisch Gladbach\",\n      \"isCancelled\": null,\n      \"messages\": [],\n      \"platform\": null,\n      \"route\": [],\n      \"scheduledPlatform\": null,\n      \"scheduledTime\": 1737619740,\n      \"time\": 1737619740,\n      \"train\": \"STR 1\",\n      \"trainNumber\": \"54726\",\n      \"via\": []\n    }\n  ]\n}\n```\n\n### Lovelace Custom Cards\nThere are some lovelace custom cards, which bringt you a better overview on your dashboard. Be sure to check them out.\n\n#### ha-departureCard\nCheck out the card [here](https://github.com/BagelBeef/ha-departureCard/).\n\n#### ha-public-transport-connection-card\nThis is currently Work-in-Progress by the maintainer, more informations are [here](https://github.com/silviokennecke/ha-public-transport-connection-card/issues/22).\n\n## Bug reporting\nOpen an issue over at [github issues](https://github.com/FaserF/ha-db_infoscreen/issues). Please prefer sending over a log with debugging enabled.\n\nTo enable debugging enter the following in your configuration.yaml\n\n```yaml\nlogger:\n    logs:\n        custom_components.db_infoscreen: debug\n```\n\nYou can then find the log in the HA settings -\u003e System -\u003e Logs -\u003e Enter \"db-infoscreen\" in the search bar -\u003e \"Load full logs\"\n\n## Thanks to\nThe data is coming from the [dbf.finalrewind.org](https://dbf.finalrewind.org/) website (if no custom API Server is specified).\nThe backend data is coming from [a db-infoscreen - (formerly db-fakedisplay) server](https://github.com/derf/db-fakedisplay/tree/main) - with a huge thanks to [derf](https://github.com/derf) for this great project!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaserf%2Fha-db_infoscreen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaserf%2Fha-db_infoscreen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaserf%2Fha-db_infoscreen/lists"}