Skip to content

Commit

Permalink
Updated markdown to use updated syntax (home-assistant#12040)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
foxleigh81 and frenck authored Mar 2, 2020
1 parent 42a8fa1 commit c4d59c4
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions source/_integrations/uk_transport.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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:

{% raw %}

```yaml
# Example configuration.yaml entry for a template sensor to access the attributes of the next departing train.
- platform: template
sensors:
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:
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:
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:
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:
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
follows:

Expand Down

0 comments on commit c4d59c4

Please sign in to comment.