I tested 0.114 and the new functionality still doesn’t work. I have reported the problem.
I’m pleased to report that the new functionality works in 0.115.
Here’s a simple demonstration of how listeners are assigned to entities when your template uses expand
.
Let’s say we have three groups, where the third one incorporates the first two (i.e nested groups).
lights_downstairs:
- light.family_mantle
- light.family_ceiling
- light.kitchen_ceiling
lights_upstairs:
- light.hallway_ceiling
lights:
- group.lights_downstairs
- group.lights_upstairs
The following template is assigned listeners to each group and, most importantly, to each one of the four entities represented by the groups:
In addition, you can add/subtract entities from a group, execute Reload Groups, and the listeners are automatically updated.
just wondering if we could also subtract expanded groups?
something like:
for s in (expand('group.all_switches') - expand('group.switches_to_exclude'))
I am now using this:
{%- set ns = namespace(not_off=[]) %}
{%- for s in expand('group.iungo_switches_actueel')
if s.entity_id not in
['sensor.inductieplaat_actueel','sensor.patchboard_zolder_actueel'] and
(states(s.entity_id) != '0' and
states(s.entity_id.split('_actueel')[0]|replace('sensor','switch')) == 'off') %}
{%- set ns.not_off = ns.not_off + [s] %}
{%- endfor %}
{{ns.not_off|count}}
but it would be way easier if I could subtract those listed entity_id’s which are also in a group.
I bookmarked this ages ago to answer and forgot all about it.
I’m sure you found the answer but thought I’d still reply in case anyone else wondered.
Probably an easier way to do it but this works.
expand('group.quiet_speakers')|map(attribute='entity_id')|reject('in',expand('group.night_speakers')|map(attribute='entity_id'))|list
I’m going to close this as this is the behavior of templates now.
TLDR: All templates create listeners for states objects that are hit in the template logic. So expanding a group will create listeners for each entity in said group.