mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 17:27:19 +00:00
Add is_number test (#21110)
This commit is contained in:
parent
1d9a3f41f2
commit
26a1714b1a
@ -208,6 +208,28 @@ The same thing can also be expressed as a filter:
|
|||||||
|
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
|
|
||||||
|
{% raw %}
|
||||||
|
|
||||||
|
```text
|
||||||
|
{% for energy in expand('group.energy_sensors') if is_number(energy.state) %}
|
||||||
|
{{ energy.state }}
|
||||||
|
{%- if not loop.last %}, {% endif -%}
|
||||||
|
{% endfor %}
|
||||||
|
```
|
||||||
|
|
||||||
|
{% endraw %}
|
||||||
|
|
||||||
|
The same thing can also be expressed as a test:
|
||||||
|
|
||||||
|
{% raw %}
|
||||||
|
|
||||||
|
```text
|
||||||
|
{{ expand('group.energy_sensors')
|
||||||
|
| selectattr("state", 'is_number') | join(', ') }}
|
||||||
|
```
|
||||||
|
|
||||||
|
{% endraw %}
|
||||||
|
|
||||||
### Devices
|
### Devices
|
||||||
|
|
||||||
- `device_entities(device_id)` returns a list of entities that are associated with a given device ID. Can also be used as a filter.
|
- `device_entities(device_id)` returns a list of entities that are associated with a given device ID. Can also be used as a filter.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user