Deutsche Bahn

This integration is pending removal from Home Assistant and will be no longer available as of Home Assistant 2022.11.

The deutsche_bahn sensor will give you the departure time of the next train for the given connection. In case of a delay, the delay is also shown. Additional details are used to inform about, e.g., the type of the train, price, and if it is on time.

To enable this sensor, add the following lines to your configuration.yaml file:

# Example configuration.yaml entry
  - platform: deutsche_bahn

Configuration Variables

from string Required

The name of the start station.

to string Required

The name of the end/destination station.

offset time (Optional, default: 0.0)

Do not display departures leaving sooner than this number of seconds. Useful if you are a couple of minutes away from the stop. The formats “HH:MM” and “HH:MM:SS” are also supported.

only_direct boolean (Optional, default: false)

Only show direct connections.

This sensor stores a lot of attributes which can be accessed by other sensors, e.g., a template sensor.

# Example configuration.yaml entry
  - sensor:
    - name : "Next departure"
      state: "{{ state_attr('sensor.munich_to_ulm', 'next') }}"

The data is coming from the website.