Home » Blog » HOW TO create your own Low Battery Warning Sensor in Home Assistant.

HOW TO create your own Low Battery Warning Sensor in Home Assistant.

Video tutorial on YouTube for the Battery List
Click on the image to watch the video

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 tutorials about Home Assistant.

Thank you for your support!

Ed

You can watch the video here.


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:

End Result of the Home Assistant Battery List Tutorial

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.

Profile Picture Ed

If my videos help you and if you want to stay up to date with my tutorials and not miss anything to increase your knowledge of Home Assistant and Smart Home, subscribe to my channel and tick the bell. It also helps if you post a comment. This way more people get notified about these videos. I need your support so that I can keep creating these videos for you.

Oh, and don’t forget to hit the thumbs up for this video. This allows me to make more tutorials for you.

By supporting me, you also support my work as a music therapist to help people with mental issues.

Thank you!


,

RELATED POSTS

Back to all articles