In this Home Assistant Low Battery Warning Sensor Tutorial, I show you how you can create your own LOW BATTERY WARNING SENSOR. It doesn’t really make sense to show all the batteries in your setup and what the charge value is of each battery. Basically, I am only interested in those batteries that need to be replaced. So, in this tutorial, I will show you how to show a list of batteries on your dashboard that need to be replaced in your house. We are going to use a custom sensor template for this.
⭐⭐⭐ NOTE: ⭐⭐⭐
This article accompanies a YouTube video. I wrote it for people who would rather read than watch a video. In order to keep doing this, I would like to ask you to also check out the video, leave a comment under the video, give the video a thumbs up, and subscribe to my YouTube channel. This means that the video is offered more often to new visitors so that they also stay informed of the latest Home Assistant tutorials.
Thank you for your support!
End goal of the Low Battery Warning Sensor
First of all, I want to say that you can use a HACS integration that is called Auto Entities to create a list of low low-battery devices as well. But, this tutorial is about teaching you how you can create your own template sensor. So, it’s much more about teaching you how this actually works than the end-result. Furthermore, you can create automations that act upon the status of this template. For instance, you can send a message to your phone as soon as a battery value is lower than the threshold.
The end-result of this tutorial looks like this:
The first step is that you create a threshold helper in Home Assistant. This is covered from this point in the video.
After you’ve created the helper, you can check the state and attributes of a battery entity. There you to see what attributes you need to take into account when you create the template sensor. This is covered from this point in the video.
Now, we are going to create the custom template for the battery list. Therefore, we need to add some code to our templates.yaml.
After you’ve added this code to the templates.yaml, make sure you reload the templates.yaml. Then you can check if your freshly created sensor low_battery_devices returns a value in the developer tools. Make sure that you enter a threshold value in your threshold helper that you’ve created before. I suggest that you start with a value of 100 which should return all the battery entities in your system.
If the template sensor returns a value, then you can add the battery list to your dashboard. I use a condition card in combination with a markdown card for this.