In this automation I will send a message to all devices when a battery of any devices is below a certain percentage at eight in the morning. In this automation we will use a blue print which can be found here . A blueprint is a pre written automation created by somebody else. You can import this blueprint and add your settings to it. This save allot of time and there are very good blueprints out there.
Import the Blueprint
Open home assistant
Click on Configuration
Click on blueprints
Click on import blue print ( lover right corner )
Add this URL and click on preview blueprint
Once previewed click on Import blueprint
You will now see the blueprint in home assistant
Create the Automation with the blueprint
Click on Create Automation and fill in the settings as I did below or change it to your liking.
In the Action sections I have put in notify.notify as a service. This means it will send a message to every notify device home assistant knows. You can also push this to one device just change the service. You can find all notify services under the developer tools -> services. Then type in notify and you will get a complete list
As you can see in the image you can also exclude devices. I have no idea why you would do that but it is possible.
Conclusion of Get a notification when a battery is nearly empty automation
In this automation when it is 8 AM and the battery level is below 20% I and my wife will get a message on the Phone through the Home assistant app. I choose to do this in the morning so I can change or charge the battery and everything still keeps working that day