Configuration templates using Template engine

Say we have 10 MQTT lights that only differ by MQTT topic. We would have to create 10 light entries in our configuration. What if, instead we could specify an array containing the topic names, and then use the template engine to dynamically generate the corresponding full-text configuration which is loaded into home assistant on startup?

This is particularly powerful when considering some entities such as motion sensors require an automation for each entity. (say to turn the sensor off.)
Using the templating engine we could cycle through all registered sensors, and then generate the required automation YAML configuration on the fly.
This reduces configuration duplication, keeping your config lean and consise. Makes maintainence easier as well for the same reasons.