mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-09 10:26:52 +00:00
Merge pull request #5121 from hokus15/patch-3
The distance is in fact measured in kilometers not meters
This commit is contained in:
commit
dba8e963ea
@ -75,7 +75,7 @@ Home Assistant adds extensions to allow templates to access all of the current s
|
||||
- `utcnow()` will be rendered as UTC time.
|
||||
- For specific values: `utcnow().second`, `utcnow().minute`, `utcnow().hour`, `utcnow().day`, `utcnow().month`, `utcnow().year`, `utcnow().weekday()` and `utcnow().isoweekday()`.
|
||||
- `as_timestamp()` will convert datetime object or string to UNIX timestamp
|
||||
- `distance()` will measure the distance in meters between home, entity, coordinates.
|
||||
- `distance()` will measure the distance in kilometers between home, entity, coordinates.
|
||||
- `closest()` will find the closest entity.
|
||||
- `float` will format the output as float.
|
||||
- `strptime(string, format)` will parse a string to a datetime based on a [format][strp-format].
|
||||
@ -213,7 +213,7 @@ Closest to an entity: {{ closest(states.zone.school, 'group.children') }}{% endr
|
||||
Since closest returns a state, we can combine it with distance too.
|
||||
|
||||
```text
|
||||
{% raw %}{{ closest(states).name }} is {{ distance(closest(states)) }} meters away.{% endraw %}
|
||||
{% raw %}{{ closest(states).name }} is {{ distance(closest(states)) }} kilometers away.{% endraw %}
|
||||
```
|
||||
|
||||
## {% linkable_title Processing incoming data %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user