All of your batteries have a “device_class: battery” with the exception of 2. So it should find most of them.
The default “Battery Low Warning Level” is 20% and “Low”. All you batteries are above 20% so try setting your “Battery Low Warning Level” to 100% and all your batteries should be shown. Then adjust it back to the % you would like.
The other 2 that show a state of OK may not be shown. If you click on the green “choose entity” it should show you all the batteries is will find. See if the 2 batteries are shown in the list when you click the green “choose entity”.
If your still having problems and need help then could you please provide us your YAML of the automation? This YAML code are the settings you have selected in the automation so I can help. To do this go into your automation, top right 3 dots, Edit in YAML, copy all the code, come back to the forum and in your reply at the top tool bar click on “</>” and paste code in there.
I tried exactly that for testing and set the warning level to 97% So that each and every battery should be included. It just keeps saying no battteries found.
Please enable the device so you will get notified. Below shows a red arrow. This will allow a confirmation message. The option above will not send the confirmation message. A confirmation message is when all your batteries are OK and it just lets you know that.
The green box option is if you would also like to receive a UI notification. Play around with it and see how it works.
Thanks for sharing and maintaining this blueprint, very useful.
I have problems with getting notifications for unavailable sensors. I am using the custom actions to send an email with the smtp notification. In the email body I am using the variable {{unavailable_sensors_names}}. The difference in my situation is that my battery sensors all are binary_sensor and not just sensor, this apparently affects the outcome.
I was troubleshooting and had a look at the code in the blueprint, at /config/blueprints/automation/Blackshome/low-battery-notifications-and-actions.yaml
I fiddled around with below templating code for "unavailable_sensors_names:" in the Developer tools template editor
unavailable_sensors_names: "{% set low_battery = namespace(sensors=[]) %} {% for
state in states.sensor | rejectattr('attributes.device_class', 'undefined') |
selectattr('attributes.device_class', '==', 'battery') %}\n {% if \"unavailable\"
in state | string and not state.entity_id in exclude_sensors.entity_id %}\n {%
set low_battery.sensors = low_battery.sensors + [state.name] %}\n {% endif %}\n{%
endfor %} {{low_battery.sensors |sort(attribute='battery_level') | join(', ')}}"
I noticed that when I change states.sensor in states.binary_sensor in the blueprint yaml for unavailable_sensors_names I had success and the email contained the unavailable sensors. So I noticed that for binary sensors with state unavailable it won’t work as I expected. When the binary sensor is available it does work.
Maybe it’s unusual to have binary sensors for batteries instead of sensors?
Thanks for reaching out. It looks like it was an oversight on my part. I needed to create a binary_sensor for testing, as all my current ones are sensors, and I must have forgotten to test the unavailable state for binary_sensor. My bad
I appreciate you letting me know!
I will update the blueprint soon to fix all sensors. I will test it on my end, but if you could be so kind to let me know if it is working correctly in a real live test, I would greatly appreciate it.
Thanks for you low battery automation, and could you help me understand a message that I am receiving as a notification:
Low Battery Notification
Battery is unavailable!
Does this mean that a device that has a battery is now not available or that a device that once had a battery entity no longer has a battery entity? Is there a way to find out which device/entity is this message relates to so that I can possibly put it into the excluded group?
When an entity becomes unavailable it means that HA has seen it before and now it cant see it. It could be the battery is flat and it is not working or you don’t use it anymore but HA still is looking for it.
Go to settings > devices and services > entities tab at top > in the search type “battery” as that is the name of your entity. You will see it and then you can decide what to do with it. If you are going to keep it, maybe use a better friendly name for your entity.
PS: Better to decide what you want to do with the entity rather than just excluding it as you will keep your HA clean.
Thanks a heap for your guidance Blacky. I am still coming to terms with HASS Device/Entity structure and naming, but your suggestion lead me straight to the ‘Battery’.
No problem at all, your welcome. The more you use it the easier it will be.
To change the friendly name once you find the entity click on it then click on the cog wheel and you will see “Name” this is were you can change the friendly name. Click Here for the FAQ on it.
I have been using this Blueprint for a few weeks. I did not notice this before. But after upgrading to 2024.7 I ran Watchman. It says I am missing two services mentioned by this Blueprint. One is notify.mobile_app_ and the other is todo.add_item. Is there something I need to do to make sure these services are installed? Thanks. Great Blueprint.
Could you please provide us your YAML of the automation? This YAML code are the settings you have selected in the automation so I can try and recreate what is happening. To do this go into your automation, top right 3 dots, Edit in YAML, copy all the code, come back to the forum and in your reply at the top tool bar click on “</>” and paste code in there.