home-assistant.io/source/_components/sensor.deutsche_bahn.markdown
akloeckner a3e449edb5 add only_direct option to sensor.deutsche_bahn (#4542)
* add only_direct option to sensor.deutsche_bahn

goes along with https://github.com/home-assistant/home-assistant/pull/11999

* Update style
2018-01-29 23:29:39 +01:00

1.5 KiB

layout title description date sidebar comments sharing footer ha_category logo ha_iot_class ha_release
page Deutsche Bahn Instructions how to integrate timetable data for traveling in Germany within Home Assistant. 2015-06-02 21:45 true false true true Transport db.png Cloud Polling 0.14

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 eg. 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
sensor:
  - platform: deutsche_bahn
    from: NAME_OF_START_STATION
    to: NAME_OF_FINAL_STATION

{% configuration %} from: description: The name of the start station. required: true type: string to: description: The name of the end/destination station. required: true type: string only_direct: description: Only show direct connections. required: false type: boolean default: false {% endconfiguration %}

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

# Example configuration.yaml entry
sensor:
  platform: template
  sensors:
    next_departure:
      value_template: '{% raw %}{{ states.sensor.munich_to_ulm.attributes.next }}{% endraw %}'
      friendly_name: 'Next departure'

The data is coming from the bahn.de website.