I tried a lot of battery monitor apps but none of them worked. A much better solution was good old crontab alone.
sudo nano /usr/local/bin/BatteryWarn
Enter this code:
#!/bin/bash
bper=$(/usr/sbin/ioreg -l | /usr/bin/awk '$3~/Capacity/{c[$3]=$5}END{OFMT="%.3f";max=c["\"MaxCapacity\""];print(max>0?100*c["\"CurrentCapacity\""]/max:"?")}')
bpern=$(echo "$bper" | cut -d. -f 1)
if [ $bpern -lt 15 ] ; then
say "danger danger battery low"
fi
Press Ctrl+X, Y, Enter
to save the file.
EDITOR=nano crontab -e
Enter this code:
*/1 * * * * /usr/local/bin/BatteryWarn
Press Ctrl+X, Y, Enter
to save the file.
Now your Mac will talk to you, reminding you every minute, when the battery is low!
Posted 7-20-2020