mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-21 08:16:53 +00:00
add new jinja test and filters (#24342)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
parent
6c8293598d
commit
40d3bdf240
@ -110,6 +110,16 @@ Print out a list of all the sensor states:
|
||||
|
||||
{% endraw %}
|
||||
|
||||
Entities that are on:
|
||||
|
||||
{% raw %}
|
||||
|
||||
```text
|
||||
{{ ['light.kitchen', 'light.dinig_room'] | select('is_state', 'on') | list }}
|
||||
```
|
||||
|
||||
{% endraw% }
|
||||
|
||||
Other state examples:
|
||||
{% raw %}
|
||||
|
||||
@ -142,6 +152,9 @@ Other state examples:
|
||||
{{ as_local(states.sensor.time.last_changed) }}
|
||||
|
||||
{{ states('sensor.expires') | as_datetime }}
|
||||
|
||||
# Make a list of states
|
||||
{{ ['light.kitchen', 'light.dinig_room'] | map('states') | list }}
|
||||
```
|
||||
|
||||
{% endraw %}
|
||||
@ -182,6 +195,26 @@ With strings:
|
||||
|
||||
{% endraw %}
|
||||
|
||||
List of friendly names:
|
||||
|
||||
{% raw %}
|
||||
|
||||
```text
|
||||
{{ ['binary_sensor.garage_door', 'binary_sensor.front_door'] | map('state_attr', 'friendly_name') | list }}
|
||||
```
|
||||
|
||||
{% endraw% }
|
||||
|
||||
List of lights that are on with a brightness of 255:
|
||||
|
||||
{% raw %}
|
||||
|
||||
```text
|
||||
{{ ['light.kitchen', 'light.dinig_room'] | select('is_state', 'on') | select('is_state_attr', 'brightness', 255) | list }}
|
||||
```
|
||||
|
||||
{% endraw% }
|
||||
|
||||
### Working with Groups
|
||||
|
||||
Not supported in [limited templates](#limited-templates).
|
||||
|
Loading…
x
Reference in New Issue
Block a user