APC UPS Setup and Calibration
Note: This is for a single host setup if you want to share the ups see https://herold.space/share-ups-using-nut-on-a-raspberry-pi
Install the apcupsd daemon and configure it.
apt install apcupsd sed -i "s/\/dev\/ttyS0/\/dev\/usb\/hiddev0/g" /etc/apcupsd/apcupsd.conf sed -i "s/BATTERYLEVEL 5/BATTERYLEVEL 20/g" /etc/apcupsd/apcupsd.conf sed -i "s/MINUTES 3/MINUTES 7/g" /etc/apcupsd/apcupsd.conf systemctl restart apcupsd apcaccess status
Lead-acid batteries lose capacity over time and after 3 to 5 years they need to be replaced. Therefore it’s important to calibrate them once a year.
Before you start make sure the battery is charged at 100% and has a load of at least 30% attached. Also write down the value of “TIMELEFT”
apcaccess | grep -E "BCHARGE|LOADPCT|TIMELEFT"
First stop the apcupsd daemon and then run apctest.
systemctl stop apcupsd apctest 1) Test kill UPS power 2) Perform self-test 3) Read last self-test result 4) View/Change battery date 5) View manufacturing date 6) View/Change alarm behavior 7) View/Change sensitivity 8) View/Change low transfer voltage 9) View/Change high transfer voltage 10) Perform battery calibration 11) Test alarm 12) View/Change self-test interval Q) Quit
Select entry 10 and monitor the calibration process.
It will drain the battery to 25% and afterwards charge it back up.
Once it’s done start apcupsd again and check the new “TIMELEFT” value.
systemctl start apcupsd apcaccess | grep -E "TIMELEFT"
Make sure it’s over 10 minutes otherwise replace the battery.
Replace firstname.lastname@example.org with your email.
It will remind you once a year to do calibration.
cat << 'EOF' > /etc/cron.daily/batterycalibrationreminder #!/bin/bash EMAIL="email@example.com" if [[ `/usr/sbin/apcaccess | grep BATTDATE | grep "$(date +%m-%d)"` ]]; then /usr/sbin/apcaccess | mail -s "battery due for calibration" $EMAIL fi EOF chmod +x /etc/cron.daily/batterycalibrationreminder