Use yaml anchors for this template sensor?

I just stumbled upon your post because I was looking for yaml “anchors”. This article appears together with yours, maybe it helps. I believe that you can realize what you’re looking for by using the “node anchors and merge key texts” procedure: Howto create battery alert without creating a template for every device