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. To keep doing this, I want to ask you to 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!
Ed
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:
Steps
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.
You can download the code to copy and paste here.
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.
You can download the code to copy and paste here.
I need your help!
You will be doing me a huge favor if you subscribe to my channel if you haven’t already. And, you will help me a lot if you also give this video a thumbs up and leave a comment. This way, YouTube will present this video to new people, making the channel grow! In the video description, you will also find information about how you can sponsor me so that I can continue to make these tutorials for you.
Thank you!