The reason is that templates are not available on the entity_id field in any trigger. You can still use a template trigger and it will still contain an offending entity_id that caused the trigger. So just change to that.
I‘m afraid I can’t follow you.
A template trigger gives yes or no. How can I implement a dynamic list of entities there?
And what do you mean by offending entities?
However, this kind of template isn’t particularly useful for a Template Trigger. Why? Because it will trigger when template’s result changes from false to true and won’t trigger again until it first changes back to false. That’s how a Template Trigger works.
So if the count of unavailable sensors increases from 0 to 1 it will trigger but if the count continues to increase above 1 it won’t trigger again. The count has to first decrease to 0 to “reset” the Template Trigger.
Despite my best intentions to explain the limitation of a Template Trigger, I overlooked to mention how to mitigate it (with a Template Sensor).
FWIW, I even recently showed someone how to do the same thing with a Template Sensor that reports which entity recently changed state (with some limitations).
Holy guacamoly! After reading this seems to be a very promising approach! Especially the service to set a group, didn’t know about that.
I could have updated the group every night with the template and your approach with template sensor is more than enough. I’ll try it and will let you know! Thanks a lot