That’s a clever use of selectattr() to filter for any entities that are currently on (at least I think that was the intention), but is that what the OP wanted?
I also thought it might be some deft Jinja-fu but (after testing it) it doesn’t do that.
Which leads me to ask why is it there? The template produces the same result without it. Perhaps a fragment from some other template that was used to create this one?
Good point - I tested it with one of my groups and didn’t realize that it didn’t even work the way I surmised it did. Since it seems to pass everything, it must either interpret the string as boolean “true”, or simply pass it straight through because it’s not the type it was expecting (as templates sometimes do, but less so in 2021.10).
The codeblocks editor Home Assistant uses is extremely janky and has been for some time.
In the template editor on my iPad if I try to delete something from the middle of a line it deletes from the end of the line instead. Copy an replace have unpredictable results.
Even in my main web browser on my desktop sometimes typing comes out backwards in the Lovelace editor. e.g. entity: comes out as :ytitne.
@flemmingss if you have been following along, the template should be: