Fixing templates (#7468)

Updating the examples to use the things we keep telling people to use ;)
This commit is contained in:
DubhAd 2018-11-11 20:16:50 +00:00 committed by Franck Nijhof
parent e1967c95ab
commit 0b17f216a2

View File

@ -33,10 +33,10 @@ sensor:
solar_angle: solar_angle:
friendly_name: "Sun angle" friendly_name: "Sun angle"
unit_of_measurement: 'degrees' unit_of_measurement: 'degrees'
value_template: "{{ states.sun.sun.attributes.elevation }}" value_template: "{{ state_attr('sun.sun', 'elevation') }}"
sunrise: sunrise:
value_template: "{{ states.sun.sun.attributes.next_rising }}" value_template: "{{ state_attr('sun.sun', 'next_rising') }}"
``` ```
{% endraw %} {% endraw %}
@ -103,7 +103,7 @@ sensor:
solar_angle: solar_angle:
friendly_name: "Sun Angle" friendly_name: "Sun Angle"
unit_of_measurement: '°' unit_of_measurement: '°'
value_template: "{{ '%+.1f'|format(states.sun.sun.attributes.elevation) }}" value_template: "{{ '%+.1f'|format(state_attr('sun.sun', 'elevation')) }}"
``` ```
{% endraw %} {% endraw %}
@ -162,7 +162,7 @@ sensor:
value_template: >- value_template: >-
{% if is_state('switch.kettle', 'off') %} {% if is_state('switch.kettle', 'off') %}
off off
{% elif states.switch.kettle.attributes.kwh|float < 1000 %} {% elif state_attr('switch.kettle', 'kwh')|float < 1000 %}
standby standby
{% elif is_state('switch.kettle', 'on') %} {% elif is_state('switch.kettle', 'on') %}
on on