mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-13 20:36:52 +00:00
Updated markdown to use updated syntax (#12040)
* Updated markdown to use updated syntax
The original template sensor code caused a syntax error. This one does not.
* 🚑 Fix build
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
parent
42a8fa1b6c
commit
c4d59c405a
@ -78,27 +78,36 @@ Refer to the [API reference webpage](https://developer.transportapi.com/docs?ram
|
|||||||
|
|
||||||
Attributes can be accessed using the [template sensor](/integrations/template) as per this example:
|
Attributes can be accessed using the [template sensor](/integrations/template) as per this example:
|
||||||
|
|
||||||
|
{% raw %}
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# Example configuration.yaml entry for a template sensor to access the attributes of the next departing train.
|
# Example configuration.yaml entry for a template sensor to access the attributes of the next departing train.
|
||||||
- platform: template
|
- platform: template
|
||||||
sensors:
|
sensors:
|
||||||
next_train_status:
|
next_train_status:
|
||||||
friendly_name: 'Next train status'
|
friendly_name: 'Next train status'
|
||||||
value_template: {% raw %}"{{state_attr('sensor.next_train_to_wat', 'next_trains')[0].status}}"{% endraw %}
|
value_template: >-
|
||||||
|
{{state_attr('sensor.next_train_to_wat', 'next_trains')[0].status}}
|
||||||
next_trains_origin:
|
next_trains_origin:
|
||||||
friendly_name: 'Next train origin'
|
friendly_name: 'Next train origin'
|
||||||
value_template: {% raw %}"{{state_attr('sensor.next_train_to_wat', 'next_trains')[0].origin_name}}"{% endraw %}
|
value_template: >-
|
||||||
|
{{state_attr('sensor.next_train_to_wat', 'next_trains')[0].origin_name}}
|
||||||
next_trains_estimated:
|
next_trains_estimated:
|
||||||
friendly_name: 'Next train estimated'
|
friendly_name: 'Next train estimated'
|
||||||
value_template: {% raw %}"{{state_attr('sensor.next_train_to_wat', 'next_trains')[0].estimated}}"{% endraw %}
|
value_template: >-
|
||||||
|
{{state_attr('sensor.next_train_to_wat', 'next_trains')[0].estimated}}
|
||||||
next_trains_scheduled:
|
next_trains_scheduled:
|
||||||
friendly_name: 'Next train scheduled'
|
friendly_name: 'Next train scheduled'
|
||||||
value_template: {% raw %}"{{state_attr('sensor.next_train_to_wat', 'next_trains')[0].scheduled}}"{% endraw %}
|
value_template: >-
|
||||||
|
{{state_attr('sensor.next_train_to_wat', 'next_trains')[0].scheduled}}
|
||||||
next_trains_platform:
|
next_trains_platform:
|
||||||
friendly_name: 'Next train platform'
|
friendly_name: 'Next train platform'
|
||||||
value_template: {% raw %}"{{state_attr('sensor.next_train_to_wat', 'next_trains')[0].platform}}"{% endraw %}
|
value_template: >-
|
||||||
|
{{state_attr('sensor.next_train_to_wat', 'next_trains')[0].platform}}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
{% endraw %}
|
||||||
|
|
||||||
Bus sensors require as their `origin` a bus stop ATCO code which can be found by browsing OpenStreetMap data as
|
Bus sensors require as their `origin` a bus stop ATCO code which can be found by browsing OpenStreetMap data as
|
||||||
follows:
|
follows:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user