but, they’re still not there… seem to remember core dev talk about adding that essential functionality to the template engine, must have gotten lower on the priority list.
Hi both, thanks for your efforts to realise the above! I see it has been merged, so waiting for it to be part of a next release
As you are more experienced in templating than I am, I have a question:
Do you see any opportunity to improve the following template? I have a group of lights and I want to count all the lights of that group that are on, on a specific floor.
{{ floor_areas('ground_floor') | map('area_entities') | sum(start=[]) | select('in',expand(states.light.all_lights) | selectattr('state','eq','on') | map(attribute='entity_id') | list ) | list | count }}
with in the future:
{{ floor_entities('ground_floor') | select('in',expand(states.light.all_lights) | selectattr('state','eq','on') | map(attribute='entity_id') | list ) | list | count }}
yeah, see the example in my post above, use labels.
You now are using the states which is always a thing to prevent if possible. If you’d add labels to those lights, you can do away with the light group altogether (which is also 1 less group to maintain)
The label_entities() function returns the entity_id’s as strings, which will make it more complex to check whether they are turned on?
Only thing I can come up with:
dont know how to say, Ive pointed you to that template several times now… it just does what you want, and until you set those labels, you can not test, so no point re-iterating the same question.
Besides, this is no longer about the WTH request, but more about template support, so I’d suggest to take it to the appropriate thread in this community. or simply search for the answer, because it has been posted many times.