Learning Help: Templates to create counter for upcoming battery replacements

Hi all,

First post here, I wanted to describe a plan I have for improving my ability to effectively use templates in my configuration. I do not mind figuring out the details myself, and that’s actually the goal – trying to learn how to use Home Assistant’s core components.

I thought a good use case for templates in my situation would be to define some target battery % thresholds for my various sensors across Zigbee and Zwave devices. Many use coin cell batteries, some CR123As, some AAs. I like the idea of having an entity (or some other object) in Home Assistant correlating to each battery style that stores integer values “counting” any batteries in that category under X%. I imagine using this in a dashboard with another card showing which sensors are near battery depletion, but the counter would help me quickly identify how many batteries to buy or grab from storage.

Does this sound like the right use case for a template, or am I going down the wrong path here?

Yes. That particular task has been covered many times on the forum, and is a great place to start.

Main docs, in case you haven’t found them:

Good luck, and ask if you get stuck. If you do, what usually happens is a few well-meaning souls like myself chip in to give assistance, then a certain “numerical user” also replies with an annoyingly much more elegant solution than the ones we’d thought of :smiley: .

1 Like

Thank you!