mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-16 13:56:53 +00:00
Add more samples
This commit is contained in:
parent
4ea29a790b
commit
011c8972b3
@ -73,7 +73,7 @@ Home Assistant adds extensions to allow templates to access all of the current s
|
||||
- `distance()` will measure the distance in meters between home, entity, coordinates.
|
||||
- `closest()` will find the closest entity.
|
||||
- `relative_time(timestamp)` will format the date time as relative time vs now (ie 7 seconds)
|
||||
|
||||
- `float` will format the output as float.
|
||||
|
||||
## {% linkable_title Examples %}
|
||||
|
||||
@ -119,7 +119,12 @@ Print out a list of all the sensor states.
|
||||
|
||||
{% if states('sensor.temperature') | float > 20 %}
|
||||
It is warm!
|
||||
{%endif %}{% endraw %}
|
||||
{%endif %}
|
||||
|
||||
{{ as_timestamp(states.binary_sensor.garage_door.last_changed) }}
|
||||
|
||||
{{ as_timestamp(now) - as_timestamp(states.binary_sensor.garage_door.last_changed) }}
|
||||
{% endraw %}
|
||||
```
|
||||
|
||||
### {% linkable_title Distance examples %}
|
||||
@ -183,4 +188,11 @@ It depends per component or platform but it is common to be able to define a tem
|
||||
|
||||
# Extract third prime number
|
||||
{% raw %}{{ value_json.primes[2] }}{% endraw %}
|
||||
|
||||
# Format output
|
||||
{% raw %}{{ "%+.1f" | value_json }}{% endraw %}
|
||||
|
||||
# Calculations
|
||||
{% raw %}{{ value_json | multiply(1024) }}{% endraw %}
|
||||
{% raw %}{{ value_json.used | multiply(0.0001) | round(0) }}{% endraw %}
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user