# apctest

apctest is a program that allows you to directly talk to your UPS and run certain tests. It will function either for Simple Signaling UPSes (dumb UPSes) or for Smart UPSes.

## Running apctest for a Simple Signaling UPS

Shutdown apcupsd if it is running.
Make sure your /etc/apcupsd/apcupsd.conf file has UPSTYPE backups and UPSCABLE simple
Normally apctest will have been built and installed by default, otherwise, you can explicitly build it on Unix with:

cd <apcupsd-source-directory>
make apctest
./apctest
on Win32 systems, use:
make apctestwin32
./apctest

It will present you with the following output

    2001-02-07 04:08:26 apctest 3.8.5 (3 January 2002) redhat
    Checking configuration ...
    sharenet.type = DISABLE
    cable.type = CUSTOM_SIMPLE
    mode.type = BK
    Setting up serial port ...
    Creating serial port lock file ...
    Doing prep_serial() ...
    Hello, this is the apcupsd Cable Test program.
    This part of apctest is for testing dumb UPSes (ones that uses signaling rather than commands.
    Most tests enter a loop polling every second for 10 seconds.

Then it will present you with the following list of choices:

    1) Test 1 - normal mode
    2) Test 2 - no cable
    3) Test 3 - no power
    4) Test 4 - low battery (requires test 3 first)
    5) Test 5 - battery exhausted
    6) Test 6 - kill UPS power
    7) Test 7 - run tests 1 through 5
    8) Guess which is the appropriate cable
    9) quit

    Select test number:

Run tests 1, 2, and 3. Note, none of the currently supported cables will indicate a change for test 2. You can then run test 8 to see what cable it thinks you should be using. Finally run test 4.

apctest can also be run for Smart UPSes.

The print out of your testing will be written to the file apctest.output. If you are unable to solve your problem, you can try posting that file to the development mailing list, and perhaps we can help you. In this case, please also include information on your operating system, which version of apcupsd you are using, your UPS model, and also your apcupsd.conf file.

## Running apctest for a Smart UPS

Shutdown apcupsd if it is running.
Make sure your /etc/apcupsd/apcupsd.conf file has UPSTYPE backups and UPSCABLE simple
Normally apctest will have been built and installed by default, otherwise, you can explicitly build it on Unix with:

cd <apcupsd-source-directory>
make apctest
./apctest
on Win32 systems, use:
make apctestwin32
./apctest

It will present you with the following output

    2002-01-03 21:04:57 apctest 3.8.5 (3 January 2002) redhat
    Checking configuration ...
    sharenet.type = DISABLE
    cable.type = CUSTOM_SMART

    You are using a SMART cable type, so I'm entering SMART test mode
    mode.type = SMART
    Setting up serial port ...
    Creating serial port lock file ...
    Hello, this is the apcupsd Cable Test program.
    This part of apctest is for testing Smart UPSes.
    Please select the function you want to perform.

    1) Query the UPS for all known values
    2) Perform a Battery Runtime Calibration
    3) Abort Battery Calibration
    4) Monitor Battery Calibration progress
    5) Quit

    Select function number:

Item 1 will probe the UPS for all values known to apcupsd and present them in rather raw format. This output can be useful for providing technical support if you are having problems with your UPS.

Item 2 will perform a Battery Runtime Calibration. This test will only be performed if your battery is 100% charged. Running the test will cause the batteries to be discharged to approximately 30% of capacity. The exact number depends on the UPS model. In any case, apctest will abort the test if it detects that the battery charge is 20% or less.

The advantage of doing this test is that the UPS will be able to recalibrate the remaining runtime counter that it maintains in its firmware. As your batteries age, they tend to hold less of a charge, so the runtime calibration may not be accurate after several years.

We recommend that perform a Battery Calibration about once a year. You should not peform this calibration too often since discharging the batteries tends to shorten their lifespan.

Item 3 can be used to abort a Battery Calibration in progress, if you some how became disconnected.

Item 4 can be used to restart the monitoring of a Battery Calibration if you shome how become disconnected during the test.

Item 5 will terminate apctest.