I had an experience with a car keyless entry and starting device’s battery going down to the point it would no longer open the door. It gave a warning. For about a week I would have to depress the button several times to open the door. Eventually, it came to the point where I had to stand in a certain position before the door would unlock. Then, one day the door would not unlock. The battery had died.
I realize not every battery gives warning, so this is something we need to prepare for. In my case the battery went out at home, so the spare key was retrieved and the problem solved. Unfortunately, the possibility exists that this could happen when one is not home, and there is no immediate access to the spare key.
The solution is to open the device and see the number on the battery, or look the number up in the manual. Opening the device requires a small flathead screwdriver. Keeping a spare battery and a small flathead screwdriver in your car is easy. Just open the package, since these batteries often come two to a package. You will need scissors to open the pack. This works if you have an actual key, and many such devices do. Just press the button and pull the key out to access the interior of the car. But, without that battery will you be able to start the car? The key gets you in to access the battery which still must be changed.
There are YouTube videos to show you how to get at the battery. I suggest familiarizing yourself with the process before the day of need comes.