If you are new to HA or templates then watch this video, it explains the fundamentals quiet elegantly. Templates are really not that difficult once you grasp the basics and offers very rich & powerful features to enhance the functionality of Home Assistant.