Binding for DeutscheBahn timetable

Hi all,

i’ve read the post by @Petrows https://community.openhab.org/t/timetable-for-deutsche-bahn-db-and-local-ka-trains-system/112611 and since i’ve to go by train to work every day i want to have live information, especially about delays…, for all trains leaving at my local train station.
So i’ve decided to implement an binding for the DB timetable api, that’ ready to be tested now and i’m happy about feedback.

The issue for the binding can be found here:

The branch is found here:

PR is about to be opened.

The binding provides two things:

  • a timetable bridge that represents the whole timetable for a station
  • a train thing that represents a train within the timetable

Sample configuration

timetable.things

Bridge deutschebahn:timetable:timetableLehrte "Fahrplan Lehrte" [ accessToken="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", trainFilter="departures", evaNo="8000226" ] {
  Thing deutschebahn:train:timetableLehrte:lehrteZug1 "Zug 1" [ position="1" ]
  Thing deutschebahn:train:timetableLehrte:lehrteZug2 "Zug 2" [ position="2" ]
}

timetable.items

// Groups
Group zug1 "Zug 1"
Group zug1Fahrt "Zug 1 Fahrt" (zug1)
Group zug1Ankunft "Zug 1 Ankunft" (zug1)
Group zug1Abfahrt "Zug 1 Abfahrt" (zug1)

// Trip Information
String Zug1_Trip_Category "Kategorie" (zug1Fahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:trip#category"}
String Zug1_Trip_Number "Nummer" (zug1Fahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:trip#number"}
String Zug1_Trip_FilterFlags "Filter" (zug1Fahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:trip#filter-flags"}
String Zug1_Trip_TripType "Fahrttyp" (zug1Fahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:trip#trip-type"}
String Zug1_Trip_Owner "Unternehmen" (zug1Fahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:trip#owner"}


// Arrival Information
DateTime Zug1_Arrival_Plannedtime "Geplante Zeit" (zug1Ankunft) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:arrival#planned-time"}
DateTime Zug1_Arrival_Changedtime "Geänderte Zeit" (zug1Ankunft) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:arrival#changed-time"}
String Zug1_Arrival_Plannedplatform "Geplantes Gleis" (zug1Ankunft) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:arrival#planned-platform"}
String Zug1_Arrival_Changedplatform "Geändertes Gleis" (zug1Ankunft) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:arrival#changed-platform"}
String Zug1_Arrival_Line "Linie" (zug1Ankunft) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:arrival#line"}
String Zug1_Arrival_Plannedintermediatestations "Geplante Halte" (zug1Ankunft) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:arrival#planned-intermediate-stations"}
String Zug1_Arrival_Changedintermediatestations "Geänderte Halte" (zug1Ankunft) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:arrival#changed-intermediate-stations"}
String Zug1_Arrival_Plannedfinalstation "Geplanter Start-/Zielbahnhof" (zug1Ankunft) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:arrival#planned-final-station"}
String Zug1_Arrival_Changedfinalstation "Geänderter Start-/Zielbahnhof" (zug1Ankunft) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:arrival#changed-final-station"}
String Zug1_Arrival_Messages "Meldungen" (zug1Ankunft) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:arrival#messages"}
String Zug1_Arrival_Plannedstatus "Geplanter Status" (zug1Ankunft) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:arrival#planned-status"}
String Zug1_Arrival_Changedstatus "Geänderter Status" (zug1Ankunft) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:arrival#changed-status"}
DateTime Zug1_Arrival_Cancellationtime "Stornierungs-Zeitpunkt" (zug1Ankunft) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:arrival#cancellation-time"}

// Arrival advanced information
String Zug1_Arrival_Planneddistantendpoint "Geplanter entfernter Endpunkt" (zug1Ankunft) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:arrival#planned-distant-endpoint"}
String Zug1_Arrival_Changeddistantendpoint "Geänderter entfernter Endpunkt" (zug1Ankunft) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:arrival#changed-distant-endpoint"}
String Zug1_Arrival_Plannedpath "Geplante Route" (zug1Ankunft) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:arrival#planned-path"}
String Zug1_Arrival_Changedpath "Geändert Route" (zug1Ankunft) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:arrival#changed-path"}
Number Zug1_Arrival_Distantchange "Geänderter Zielbahnhof" (zug1Ankunft) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:arrival#distant-change"}
Switch Zug1_Arrival_Hidden "Versteckt" (zug1Ankunft) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:arrival#hidden"}
String Zug1_Arrival_Transition "Übergang" (zug1Ankunft) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:arrival#transition"}
String Zug1_Arrival_Wings "Wings" (zug1Ankunft) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:arrival#wings"}

// Departure Information
DateTime Zug1_Departure_Plannedtime "Geplante Zeit" (zug1Abfahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:departure#planned-time"}
DateTime Zug1_Departure_Changedtime "Geänderte Zeit" (zug1Abfahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:departure#changed-time"}
String Zug1_Departure_Plannedplatform "Geplantes Gleis" (zug1Abfahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:departure#planned-platform"}
String Zug1_Departure_Changedplatform "Geändertes Gleis" (zug1Abfahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:departure#changed-platform"}
String Zug1_Departure_Line "Linie" (zug1Abfahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:departure#line"}
String Zug1_Departure_Plannedintermediatestations "Geplante Halte" (zug1Abfahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:departure#planned-intermediate-stations"}
String Zug1_Departure_Changedintermediatestations "Geänderte Halte" (zug1Abfahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:departure#changed-intermediate-stations"}
String Zug1_Departure_Plannedfinalstation "Geplanter Start-/Zielbahnhof" (zug1Abfahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:departure#planned-final-station"}
String Zug1_Departure_Changedfinalstation "Geänderter Start-/Zielbahnhof" (zug1Abfahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:departure#changed-final-station"}
String Zug1_Departure_Messages "Meldungen" (zug1Abfahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:departure#messages"}
String Zug1_Departure_Plannedstatus "Geplanter Status" (zug1Abfahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:departure#planned-status"}
String Zug1_Departure_Changedstatus "Geänderter Status" (zug1Abfahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:departure#changed-status"}
DateTime Zug1_Departure_Cancellationtime "Stornierungs-Zeitpunkt" (zug1Abfahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:departure#cancellation-time"}

// Departure advanced information
String Zug1_Departure_Planneddistantendpoint "Geplanter entfernter Endpunkt" (zug1Abfahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:departure#planned-distant-endpoint"}
String Zug1_Departure_Changeddistantendpoint "Geänderter entfernter Endpunkt" (zug1Abfahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:departure#changed-distant-endpoint"}
String Zug1_Departure_Plannedpath "Geplante Route" (zug1Abfahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:departure#planned-path"}
String Zug1_Departure_Changedpath "Geändert Route" (zug1Abfahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:departure#changed-path"}
Number Zug1_Departure_Distantchange "Geänderter Zielbahnhof" (zug1Abfahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:departure#distant-change"}
Switch Zug1_Departure_Hidden "Versteckt" (zug1Abfahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:departure#hidden"}
String Zug1_Departure_Transition "Übergang" (zug1Abfahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:departure#transition"}
String Zug1_Departure_Wings "Wings" (zug1Abfahrt) {channel="deutschebahn:train:timetableLehrte:lehrteZug1:departure#wings"}

Example widget for displaying train details

uid: timetable_train_details
tags:
  - card
props:
  parameters:
    - context: item
      label: Geplante Zeit
      name: planned_time
      required: true
      type: TEXT
    - context: item
      label: Geänderte Zeit
      name: changed_time
      required: true
      type: TEXT
    - context: item
      label: Geplantes Gleis
      name: planned_platform
      required: true
      type: TEXT
    - context: item
      label: Geändertes Gleis
      name: changed_platform
      required: true
      type: TEXT
    - context: item
      label: Linie
      name: line
      required: true
      type: TEXT
    - context: item
      label: Meldungen
      name: messages
      required: true
      type: TEXT
    - context: item
      label: Geplanter Start-/Zielbahnhof
      name: planned_final_station
      required: true
      type: TEXT
    - context: item
      label: Geplante Halte
      name: planned_intermediate_stations
      required: true
      type: TEXT
    - context: item
      label: Geändeter Start-/Zielbahnhof
      name: changed_final_station
      required: true
      type: TEXT
    - context: item
      label: Geänderte Halte
      name: changed_intermediate_stations
      required: true
      type: TEXT
    - context: item
      label: Geänderter Status
      name: changed_state
      required: true
      type: TEXT
    - context: item
      label: Kategorie
      name: category
      required: true
      type: TEXT
    - context: item
      label: Nummer
      name: number
      required: true
      type: TEXT
  parameterGroups: []
timestamp: Oct 14, 2021, 11:24:45 AM
component: f7-card
config:
  style:
    padding: 10px
slots:
  default:
    - component: f7-row
      slots:
        default:
          - component: f7-col
            config:
              width: 15
            slots:
              default:
                - component: Label
                  config:
                    text: "=items[props.planned_time].displayState + (items[props.changed_time].state != 'NULL' && items[props.changed_time].state != items[props.planned_time].state ? ' (' + items[props.changed_time].displayState + ')' : '')"
                    style:
                      color: "=items[props.changed_time].state != 'NULL' && items[props.changed_time].state != items[props.planned_time].state ? 'red' : ''"
          - component: f7-col
            config:
              width: 75
            slots:
              default:
                - component: Label
                  config:
                    text: "=(items[props.changed_state].state == 'c' ? 'Zug fällt aus - ' : '') + (items[props.messages].state != 'NULL' ? items[props.messages].state : '')"
                    style:
                      color: red
          - component: f7-col
            config:
              width: 10
            slots:
              default:
                - component: Label
                  config:
                    text: "=items[props.changed_platform].state != 'NULL' ? items[props.changed_platform].state :  items[props.planned_platform].state"
                    style:
                      color: "=items[props.changed_platform].state != 'NULL' ? 'red' : ''"
                      text-align: right
    - component: f7-row
      slots:
        default:
          - component: f7-col
            config:
              width: 15
            slots:
              default:
                - component: Label
                  config:
                    text: "=items[props.line].state != 'NULL' ? (items[props.category].state + ' ' + items[props.line].state) : (items[props.category].state + ' ' + items[props.number].state)"
          - component: f7-col
            config:
              width: 50
            slots:
              default:
                - component: Label
                  config:
                    text: "=items[props.changed_intermediate_stations].state != 'NULL' ? items[props.changed_intermediate_stations].state : items[props.planned_intermediate_stations].state"
                    style:
                      color: "=items[props.changed_intermediate_stations].state != 'NULL' ? 'red' : ''"
          - component: f7-col
            config:
              width: 35
            slots:
              default:
                - component: Label
                  config:
                    text: "=items[props.changed_final_station].state != 'NULL' ? items[props.changed_final_station].state : items[props.planned_final_station].state"
                    style:
                      color: "=items[props.changed_final_station].state != 'NULL' ? 'red' : ''"
                      font-weight: bold
                      text-align: right

I’ve created four trains things and wrapped them into an list card:

component: oh-list-card
config:
  simpleList: false
  mediaList: false
  accordionList: false
  title: Abfahrten Hannover HBF
  noBorder: true
  noShadow: true
  style:
    margin: 0px
slots:
  default:
    - component: widget:timetable_train_details
      config:
        planned_time: Abfahrt1_Departure_Plannedtime
        changed_time: Abfahrt1_Departure_Changedtime
        planned_platform: Abfahrt1_Departure_Plannedplatform
        changed_platform: Abfahrt1_Departure_Changedplatform
        line: Abfahrt1_Departure_Line
        messages: Abfahrt1_Departure_Messages
        planned_final_station: Abfahrt1_Departure_Plannedfinalstation
        planned_intermediate_stations: Abfahrt1_Departure_Plannedintermediatestations
        changed_final_station: Abfahrt1_Departure_Changedfinalstation
        changed_intermediate_stations: Abfahrt1_Departure_Changedintermediatestations
        changed_state: Abfahrt1_Departure_Changedstatus
        category: Abfahrt1_Kateogrie
        number: Abfahrt1_Zugnummer
    - component: widget:timetable_train_details
      config:
        planned_time: Abfahrt2_Departure_Plannedtime
        changed_time: Abfahrt2_Departure_Changedtime
        planned_platform: Abfahrt2_Departure_Plannedplatform
        changed_platform: Abfahrt2_Departure_Changedplatform
        line: Abfahrt2_Departure_Line
        messages: Abfahrt2_Departure_Messages
        planned_final_station: Abfahrt2_Departure_Plannedfinalstation
        planned_intermediate_stations: Abfahrt2_Departure_Plannedintermediatestations
        changed_final_station: Abfahrt2_Departure_Changedfinalstation
        changed_intermediate_stations: Abfahrt2_Departure_Changedintermediatestations
        changed_state: Abfahrt2_Departure_Changedstatus
        category: Abfahrt2_Kateogrie
        number: Abfahrt2_Zugnummer
    - component: widget:timetable_train_details
      config:
        planned_time: Abfahrt3_Departure_Plannedtime
        changed_time: Abfahrt3_Departure_Changedtime
        planned_platform: Abfahrt3_Departure_Plannedplatform
        changed_platform: Abfahrt3_Departure_Changedplatform
        line: Abfahrt3_Departure_Line
        messages: Abfahrt3_Departure_Messages
        planned_final_station: Abfahrt3_Departure_Plannedfinalstation
        planned_intermediate_stations: Abfahrt3_Departure_Plannedintermediatestations
        changed_final_station: Abfahrt3_Departure_Changedfinalstation
        changed_intermediate_stations: Abfahrt3_Departure_Changedintermediatestations
        changed_state: Abfahrt3_Departure_Changedstatus
        category: Abfahrt3_Kateogrie
        number: Abfahrt3_Zugnummer
    - component: widget:timetable_train_details
      config:
        planned_time: Abfahrt4_Departure_Plannedtime
        changed_time: Abfahrt4_Departure_Changedtime
        planned_platform: Abfahrt4_Departure_Plannedplatform
        changed_platform: Abfahrt4_Departure_Changedplatform
        line: Abfahrt4_Departure_Line
        messages: Abfahrt4_Departure_Messages
        planned_final_station: Abfahrt4_Departure_Plannedfinalstation
        planned_intermediate_stations: Abfahrt4_Departure_Plannedintermediatestations
        changed_final_station: Abfahrt4_Departure_Changedfinalstation
        changed_intermediate_stations: Abfahrt4_Departure_Changedintermediatestations
        changed_state: Abfahrt4_Departure_Changedstatus
        category: Abfahrt4_Kateogrie
        number: Abfahrt4_Zugnummer

Result looks like this:

Please have a try and leave comment :slight_smile:

4 Likes

PR Build in jenkins has now published jar. So for easy testing the pre built jar can be downloaded here:
https://openhab.jfrog.io/ui/native/libs-pullrequest-local/org/openhab/addons/bundles/org.openhab.binding.deutschebahn/3.2.0-SNAPSHOT/org.openhab.binding.deutschebahn-3.2.0-SNAPSHOT.jar

Hi Sönke,
I like the binding very much. My two children are studying and I can keep an eye on the times at my home station when I pick them up / bring them back to the station on the weekend.

Since only certain train lines are of interest, a corresponding filter for several lines in the timetable would be very good.

Of course, connections (station to station) would also be great, but I don’t want to set my wishes too high.

I had duplicate entries in my sitemap for a few trains that were coupled together in a previous station, but I filtered them out by using a rule.

Thank you for your great work.

Hey @uk59821,

thanks for testing and your feedback.

I’ve also thought about any kind of filter for some attributes.
For example, at my local train station the trains leave in two directions, but only one of them is of interest for me.
So I thought about an filter for the planned-path value, for example an bridge attribute to specify an pipe separated list
of stations. Trains would than only be contained within the timetable if they pass by any of the specified stations.

Would this solve your “connection, station to station” filter, too?
Would you need the filter for the lines in addition to that?

Due the documentation does not contain any examples for like coupled or split trains i’ve not considered
this during implementation (yet). There is an attribute/channel for the transiation. May you provide
me your eva-nr. and the train(s) where this happens? Then i could have a look into the raw data and check if
i have an idea to fix this within the binding.

Hi there,
for my home station the filter is of secondary importance. This is essential for my children’s place of study (e.g. Aachen). Since there are a lot of trains going to Cologne from there, I thought of a filter for certain lines “Trip_Category + Trip_Number” as a list, e.g. (“RE17,RE57”). But the idea of ​​passing train stations is also good, but not restrictive enough for the example with Cologne.

The coupled trains concern the station with evaNo “8004642”. It concerns the line “RE57” which connects Dortmund with the Sauerland. In the direction of Dortmund it has two departure stations “Winterberg (Westf)” and “Brilon-Stadt”. The trains are coupled in Bestwig.
There used to be a similar example for the ICE to Berlin, where two ICEs were coupled in Hamm. One came from Dortmund, the other from Hagen. But I don’t know if that’s still the case.

One more question, wouldn’t it be practical to map the “position” of the train as a channel instead of the Thing definition, so you could scroll through the timetable using a rule?

Regards Ulf

Hey,

thanks for your reply.

I’ve checked the raw data from api to figure out how joined / split trains are represented there.
It seems really easy: one of the two trains has an “wings” attribute set which referes to the train this one is joined to / split off.
So i could try to merge these to stops into one, but this would lead up to the problem that for for all channel (for example the planned path for departure / arrival)
two different values would be present. So i could create new channel groups for the joined/split train informations, than these values could be displayed together with
the informations of the original train - as the DB does on it’s displays. What do you think?

Here are the data examples:
Split trains

<s id="5817504398630764110-2111071441-7">
	<tl f="N" t="p" o="800348" c="RE" n="10979"/>
	<ar pt="2111071529" pp="1" l="57" ppth="Dortmund Hbf|Dortmund-H&#246;rde|Fr&#246;ndenberg|Wickede(Ruhr)|Neheim-H&#252;sten|Arnsberg(Westf)"/>
	<dp pt="2111071530" pp="1" l="57" ppth="Freienohl|Meschede|Bestwig|Olsberg|Brilon Wald"/>
</s>
<s id="-6829538668622755191-2111071441-7">
	<tl f="N" t="p" o="800348" c="RE" n="10767"/>
	<ar pt="2111071529" pp="1" l="57" wings="5817504398630764110-2111071441" ppth="Dortmund Hbf|Dortmund-H&#246;rde|Fr&#246;ndenberg|Wickede(Ruhr)|Neheim-H&#252;sten|Arnsberg(Westf)"/>
	<dp pt="2111071530" pp="1" l="57" wings="5817504398630764110-2111071441" ppth="Freienohl|Meschede|Bestwig|Bigge|Siedlinghausen|Silbach|Winterberg(Westf)"/>
</s>

Joined trains

<s id="3977096351822069653-2111071731-8">
	<tl f="N" t="p" o="800348" c="RE" n="10770"/>
	<ar pt="2111071828" pp="2" l="57" wings="-5705872262392120025-2111071739" ppth="Winterberg(Westf)|Silbach|Siedlinghausen|Bigge|Bestwig|Meschede|Freienohl"/>
	<dp pt="2111071829" pp="2" l="57" wings="-5705872262392120025-2111071739" ppth="Arnsberg(Westf)|Neheim-H&#252;sten|Wickede(Ruhr)|Fr&#246;ndenberg|Dortmund-H&#246;rde|Dortmund Hbf"/>
</s>
<s id="-5705872262392120025-2111071739-7">
	<tl f="N" t="p" o="800348" c="RE" n="10986"/>
	<ar pt="2111071828" pp="2" l="57" ppth="Brilon Stadt|Brilon Wald|Olsberg|Bestwig|Meschede|Freienohl"/>
	<dp pt="2111071829" pp="2" l="57" ppth="Arnsberg(Westf)|Neheim-H&#252;sten|Wickede(Ruhr)|Fr&#246;ndenberg|Dortmund-H&#246;rde|Dortmund Hbf"/>
</s>

Concerning the filter… The circumstance that all values are provided in different combinations of attribute values makes it difficult to filter only one channel.
So i’m thinking about an syntax to define filters with and/or links. I would prefer an solution where the bindings configuration is as flexible
to provide the information you need - instead the user (you) has to define rules to filter out the needed values. So assumed you could specify an filter like
trip#category=“RE” AND (departure#line=“17” OR departure#line=“57”) AND departure#planned-path~“Cologne”
would this make your rules obsolete and your configuration simpler?

I’ve thought about moving the position into a thing property and adding an new bridge setting “train count”. This would make it easy to implement a discovery service,
that “discovers” the configured amount of train things, so you wouldn’t need to configure them manually. But this would make it impossible to “scroll with rules” so the
filter must work for any demand.

Thanks!

Sönke

I’ve just added a filter configuration for timetable thing, so you may no specify an expression to filter those trains you want to display within your timetable.
Give it a try:

Feedback is welcome!

Hello, thank you for this fine binding.

I added the trip-owner information and a code number is returned.

How can I assign the code number to the textual name of the trip-owner?

Thank you and best regards. Paul

Hey,

thanks for your feedback and question!

Unfortunately i can’t give you an direct mapping from owner number to textual name,
as this is not included within the api description and i haven’t found one on the internet.

So we have to derive the meaning from the values that we can see.

So if i have a look at the data for Hannover Hbf for example there are the following combinations (as example):

Owner Category Number Line Display
800244 S 34459 1 DB S1
W3 WFB RE60 Westfalenbahn RE 60
R0 ENO 83526 RE30 Enno RE 30
TDHS S 34331 3 Transdev S 3
X2 erx 83481 RE19 Erixx RE10
84 IC 149 DB IC 149
80 ICE 1094 DB ICE 1094

So it seems that all Trains from DB have an number-only owner, while other evus have an textual name.
Furthermore all long-running trains seems to have only to digits, whereas local trains have six digits.

In my widget i simply obmit the owner and use the category and line information if avaliable else the number,
for me that’s enough. Maybe this would be enough for your usecase too. Otherwise try to figure out the owners that appear
at your station and specify an map transformation within openhab.

Let me know if you need any further information!

Sönke

Thank you for the explanation.

I added the owner to your widget too.

When Corona is gone, I will have a look at the train station (in my case Duisburg HBF) to get the secret aerate.

Best regards. Paul

Today deutschebahn sent me a note that they will move their APIs to a newer platform, DB API Marketplace (DB API Marketplace | DB API Marketplace), closing down Open API Portal by July 31st, 2022. Marketplace needs separate registration + API subscription. In their general information they write that the move will require changes in applications. Timetable API is there, end point suggests that URL might change.

That’s why e.g. I’m just using webscrapping for receiving these kind of figures…

As some addons (for me e.g. the DWD Plugin) is not working or everything requires for API Calls an additional registration.

Till now, never had to change / adjust a script after creation.
from the legal perspective, personally I also do not see any issue in regards of scrapping.

Hey,

i’ve recieved this mail too and will check if any modifications are required.

Best regards

Sönke

Hey,
i’ve created an issue

and PR

for updating the binding from Open-Data-Portal to DB API Marketplace.

Sönke

Good evening,

I’m considering to update my old Raspberry 1 Model B to a new RPI4 as I’d like to install a tablet next to my front door with a dashboard with plenty of information about the weather, my smart home and the departures from the trainstation nearby – OpenHAB should be the perfect solution for this matter.

I just tested OpenHAB locally on my Mac and I managed to get the DeutscheBahn binding up and running and I even added the widget for the local trainstation. Now I have a few questions:

  1. Is it possible to show trains in a certain direction only?
  2. Is it possible to show trains which stop at another certain station only? Would it be possible to add a parameter with a certain eva number to achieve this?
  3. Is it possible to add tram / underground stations? They are not included in the eva csv., but they are listed in the DB Navigator app. Do you have any idea if and how I could add them?

Thanks in advance!

Hey,

sounds like a great idea and openhab is just perfect tool to achieve this :wink:

The binding provides powerful filters that allow to select just the connections you want to display within your timetable. Just check out the attribute additionalFilter within the advanced configuration parameters and the examples within the documentation. There is one example how to select trains that stops at a certain station (departure#planned-path="Hannover Hbf").

The binding just uses the DB API as data source, which requires the eva number. So unfortunately the binding can’t provide tram and underground information. The DB Navigator app may uses other data sources too. There are already some bindings for tram / underground services available. Maybe yours is available, too.

1 Like

Thank you very much – I guess after all these hours of trial and error I overlooked the passage. Now it’s working great :grin:

Unfortunately my city is not covered by the available bindings for tram / bus / underground services, but a working DeutscheBahn plugin is great, too. Thanks again and have a nice evening!