Allow for multiple labels/areas in label_entities/area_entities

Currently, if you want to list all entities in a given area or all entities having a given label, you do this:

{{ area_entities('kitchen') }}

{{ label_entities('kitchen') }}

If you want all entities in multiple given areas you can do this:

{{ ['kitchen', 'bedroom', 'bathroom']
   | map('area_entities')
   | sum(start=[]) }}

(Practical example shown here).

Similarly, to get all entities having multiple given labels, you would do this:

{{ ['outdoor', 'battery', 'temperature']
   | map('label_entities')
   | sum(start=[]) }}

This Feature Request proposes simplifying the process by enhancing area_entities and label_entities so they support multiple entities as arguments.

{{ area_entities('kitchen', 'bedroom', 'bathroom') }}

{{ label_entities('outdoor', 'battery', 'temperature') }}

In effect, this FR asks to have them behave like expand which, when used as a function, can accept a comma-separated string or a list:

{{ ['group.doors_exterior', 'group.doors_interior'] | expand | list }}
{{ expand(['group.doors_exterior', 'group.doors_interior']) | list }}
{{ expand('group.doors_exterior', 'group.doors_interior') | list }}

2 posts were split to a new topic: Enhanced way to pass arguments

You can also use a + operator:

{{ area_entities('kitchen') 
  + area_entities('bedroom') 
  + area_entities('bathroom') }}

Or several other inelegant ways which is why this FR was created