mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-16 22:06:50 +00:00
Add example of sorting states by entity_id (#26822)
This commit is contained in:
parent
12930c3044
commit
b42f9f9e07
@ -150,6 +150,16 @@ Print out a list of all the sensor states:
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Print out a list of all the sensor states sorted by `entity_id`:
|
||||||
|
|
||||||
|
{% raw %}
|
||||||
|
|
||||||
|
```text
|
||||||
|
{% for state in states.sensor | sort(attribute='entity_id') %}
|
||||||
|
{{ state.entity_id }}={{ state.state }},
|
||||||
|
{% endfor %}
|
||||||
|
```
|
||||||
|
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
|
|
||||||
Entities that are on:
|
Entities that are on:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user