Add template sample (#595)

* Add template sample

* Fix template
This commit is contained in:
Fabian Affolter 2016-06-30 08:40:57 +02:00 committed by GitHub
parent 6ae0e35a35
commit bfbc89f1cd

View File

@ -10,11 +10,11 @@ footer: true
ha_category: Sensor
logo: db.png
ha_iot_class: "Local Polling"
ha_release: 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 `ATTRIBUTES` are used to inform about eg. the type of the train, price and if it is ontime. The data are coming from the [bahn.de](http://www.bahn.de/p/view/index.shtml) website.
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 ontime.
To enable this sensor, add the following lines to your `configuration.yaml` file:
@ -29,5 +29,18 @@ sensor:
Configuration variables:
- **from** (*Required*): The name of the start station.
- **to** (*Required*): The name of the end station.
- **to** (*Required*): The name of the end/destination station.
As already mentioned this sensor contains a lot of information to access those a [template senosr](/components/sensor.template/) can come handy.
```yaml
# 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](http://www.bahn.de/p/view/index.shtml) website.