mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-19 07:17:14 +00:00
Fixing templates (#7468)
Updating the examples to use the things we keep telling people to use ;)
This commit is contained in:
parent
e1967c95ab
commit
0b17f216a2
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user