Create filter sensors for a whole class of sensor

If at all possible, figure out whether what you want can be acheived partly or in whole using YAML tools like anchors and merging. Even a slightly reduced config entry will make the following easier…

You cannot use templates to build YAML configuration in situ, but you can use the Template editor to iterate over your entities to “print” something you can paste into your configuration file.

You’ll have to decide for yourself, based on the complexity of the sensors you are setting up, whether or not it’s actually worthwhile to take the time to construct the template.