From 0b17f216a2279fe79589569fa52a4712923efe16 Mon Sep 17 00:00:00 2001 From: DubhAd Date: Sun, 11 Nov 2018 20:16:50 +0000 Subject: [PATCH] Fixing templates (#7468) Updating the examples to use the things we keep telling people to use ;) --- source/_components/sensor.template.markdown | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/_components/sensor.template.markdown b/source/_components/sensor.template.markdown index 06c69ba5925..8fea549c842 100644 --- a/source/_components/sensor.template.markdown +++ b/source/_components/sensor.template.markdown @@ -33,10 +33,10 @@ sensor: solar_angle: friendly_name: "Sun angle" unit_of_measurement: 'degrees' - value_template: "{{ states.sun.sun.attributes.elevation }}" + value_template: "{{ state_attr('sun.sun', 'elevation') }}" sunrise: - value_template: "{{ states.sun.sun.attributes.next_rising }}" + value_template: "{{ state_attr('sun.sun', 'next_rising') }}" ``` {% endraw %} @@ -103,7 +103,7 @@ sensor: solar_angle: friendly_name: "Sun Angle" unit_of_measurement: '°' - value_template: "{{ '%+.1f'|format(states.sun.sun.attributes.elevation) }}" + value_template: "{{ '%+.1f'|format(state_attr('sun.sun', 'elevation')) }}" ``` {% endraw %} @@ -162,7 +162,7 @@ sensor: value_template: >- {% if is_state('switch.kettle', 'off') %} off - {% elif states.switch.kettle.attributes.kwh|float < 1000 %} + {% elif state_attr('switch.kettle', 'kwh')|float < 1000 %} standby {% elif is_state('switch.kettle', 'on') %} on