update uk_transport template sensor examples (#19965)

This commit is contained in:
SNoof85 2021-10-26 22:07:43 +02:00 committed by GitHub
parent 506f9d96bf
commit d8686acae2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,27 +84,22 @@ Attributes can be accessed using the [template sensor](/integrations/template) a
```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 template:
sensors: - sensor:
next_train_status: - name: Next train status
friendly_name: "Next train status" state: >-
value_template: >-
{{state_attr('sensor.next_train_to_wat', 'next_trains')[0].status}} {{state_attr('sensor.next_train_to_wat', 'next_trains')[0].status}}
next_trains_origin: - name: Next train origin
friendly_name: "Next train origin" state: >-
value_template: >-
{{state_attr('sensor.next_train_to_wat', 'next_trains')[0].origin_name}} {{state_attr('sensor.next_train_to_wat', 'next_trains')[0].origin_name}}
next_trains_estimated: - name: Next train estimated
friendly_name: "Next train estimated" state: >-
value_template: >-
{{state_attr('sensor.next_train_to_wat', 'next_trains')[0].estimated}} {{state_attr('sensor.next_train_to_wat', 'next_trains')[0].estimated}}
next_trains_scheduled: - name: Next train scheduled
friendly_name: "Next train scheduled" state: >-
value_template: >-
{{state_attr('sensor.next_train_to_wat', 'next_trains')[0].scheduled}} {{state_attr('sensor.next_train_to_wat', 'next_trains')[0].scheduled}}
next_trains_platform: - name: Next train platform
friendly_name: "Next train platform" state: >-
value_template: >-
{{state_attr('sensor.next_train_to_wat', 'next_trains')[0].platform}} {{state_attr('sensor.next_train_to_wat', 'next_trains')[0].platform}}
``` ```
@ -141,20 +136,16 @@ And the template sensor for viewing the next bus attributes.
```yaml ```yaml
# Example configuration.yaml entry for a template sensor to access the attributes of the next departing bus. # Example configuration.yaml entry for a template sensor to access the attributes of the next departing bus.
- platform: template template:
sensors: - sensor:
next_bus_route: - name: Next bus route
friendly_name: "Next bus route" state: "{{state_attr('sensor.next_bus_to_wantage', 'next_buses')[0].route}}"
value_template: "{{state_attr('sensor.next_bus_to_wantage', 'next_buses')[0].route}}" - name: Next bus direction
next_bus_direction: state: "{{state_attr('sensor.next_bus_to_wantage', 'next_buses')[0].direction}}"
friendly_name: "Next bus direction" - name: Next bus scheduled
value_template: "{{state_attr('sensor.next_bus_to_wantage', 'next_buses')[0].direction}}" state: "{{state_attr('sensor.next_bus_to_wantage', 'next_buses')[0].scheduled}}"
next_bus_scheduled: - name: Next bus estimated
friendly_name: "Next bus scheduled" state: "{{state_attr('sensor.next_bus_to_wantage', 'next_buses')[0].estimated}}"
value_template: "{{state_attr('sensor.next_bus_to_wantage', 'next_buses')[0].scheduled}}"
next_bus_estimated:
friendly_name: "Next bus estimated"
value_template: "{{state_attr('sensor.next_bus_to_wantage', 'next_buses')[0].estimated}}"
``` ```
{% endraw %} {% endraw %}