HowTo: Setup apcupsd on Rasbian 7

Step-by-Step descriptions of how to do things.
Post Reply
User avatar
^rooker
Site Admin
Posts: 1481
Joined: Fri Aug 29, 2003 8:39 pm

HowTo: Setup apcupsd on Rasbian 7

Post by ^rooker »

This HowTo is going through the steps required setting up an APC UPS over USB, monitored by apcupsd on a Debian-based system.
In this case, I've connected the UPS to a Raspberry Pi running Raspbian 8 (Jessie).

1) Connect the UPS to power
Seems obvious, but still... ;)

2) Connect USB
Then, connect the USB cable and make sure it shows up on the computer side:
ID 051d:0002 American Power Conversion Uninterruptible Power Supply
3) Install apcupsd:
On Debian-based systems (including e.g. Ubuntu), it's as easy as this:

Code: Select all

$ apt-get install apcupsd
4) Configure apcupsd to listen on USB:
Make a backup of "/etc/apcupsd/apcupsd.conf" and then open it in a text editor.

For USB connection, edit the settings to this:
(Change "UPSNAME" to whatever you like ;) )

Code: Select all

UPSNAME MyUPS
UPSCABLE usb
UPSTYPE usb
DEVICE
POLLTIME 60
Save the file and exit the editor.

5) Enable autostart of apcupsd during boot:
In "etc/default/apcupsd", change "ISCONFIGURED" to yes:
ISCONFIGURED=yes
Save the file.
This tells the system that apcupsd is to be started as a service.
Without it you also won't be able to start it using the command "service apcusd ...".

6) Restart the apcupsd:
In order to apply the changed configuration, you need to start (or restart) the apcupsd service:

Code: Select all

$ sudo service apcupsd restart
7) Test communication:

Code: Select all

$ sudo apcaccess status
If apcupsd sees the UPS and things are configured right, you should see something like this:

Code: Select all

APC      : 001,036,0874
DATE     : 2016-12-15 19:44:19 +0100  
HOSTNAME : rasputin2
VERSION  : 3.14.12 (29 March 2014) debian
UPSNAME  : rasputin2
CABLE    : USB Cable
DRIVER   : USB UPS Driver
UPSMODE  : Stand Alone
STARTTIME: 2016-12-15 19:18:12 +0100  
MODEL    : Back-UPS XS 950U   
STATUS   : ONLINE 
LINEV    : 226.0 Volts
LOADPCT  : 0.0 Percent
BCHARGE  : 100.0 Percent
TIMELEFT : 320.0 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME  : 0 Seconds
SENSE    : Medium
LOTRANS  : 155.0 Volts
HITRANS  : 280.0 Volts
ALARMDEL : 30 Seconds
BATTV    : 13.5 Volts
LASTXFER : No transfers since turnon
NUMXFERS : 0
TONBATT  : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : NO
STATFLAG : 0x05000008
SERIALNO : 3B1629X20043  
BATTDATE : 2016-07-22
NOMINV   : 230 Volts
NOMBATTV : 12.0 Volts
NOMPOWER : 480 Watts
FIRMWARE : 925.T2 .I USB FW:T2
END APC  : 2016-12-15 19:44:47 +0100
NOTE: On some distros this may not require root rights. On Raspian it doesn't, on Debian it seems it does...


Links:
Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
Post Reply