Subject: Re: apcmon (was Re: UPS hookup)
To: Michael L. VanLoon -- <>
From: David Gilbert <>
List: current-users
Date: 11/22/1995 08:32:39
>>>>> "Michael" == Michael L VanLoon <--" <>> writes:

Michael> [stuff about weird APC cables deleted]
>> I'm interested in this debate because I'm planning on purchasing a
>> UPS sometime soon.

Michael> Then why even bother with APC?  They're selfish little boys.

Michael> I've heard nothing but good things about the BEST UPCs, and
Michael> supposedly their implementation is completely open.

	We have 4 BEST UPSs.  When I phone them about a demon, I asked
if they gave out source since several of the computers that are
protected were not listed in their literature.  They were happy to
send a source code 'kit' (which includes a serial cable and some 9-25
adaptors).  I asked the guy on the phone if I needed to purchase 4
kits or if one would do.  He said that one was just fine.

	The code itself has a copyright notice on it.  The kits are
rather expensive (~$80, I think).  However, since I didn't sign
anything, I would assume that I could reverse engineer it w/o penalty.

Things I've noticed in the code:

- Wait 1 second for each charcter sent (now that's *slow*)
- Takes 2 seconds for fortress to respond
- "f\r" seems to be the 'request status' command
- The returned string will start with a digit, end with '\r' and is in Hex
- if char buf[256] is your serial read buffer,
	- buf[17] == 1 when the inverter is on.
	- When I say buf[x] & 1, convert buf[x] to binary first
	- buf[20] & 1 --> low AC out
	- buf[21] & 2 --> near low battery
	- buf[22] & 2 --> user test alarm
	- buf[20] & 8 is some other alarm.
	- buf[58..61] is MMSS time left on battery

- This string should be 80 characters long, and should satisfy the
  following checksum:
	- for the first 40 charcters, do
		- Take each pair of hex digits, and sum their binary
                  value as bytes.
	- sum mod 256 should be 0.

	That seems to be all they check for in that string.  You'd
think that there's more in there, but only someone who wants to
experiment a lot would find out.  There also might be other commands,
but I can find any documented or used here.

	Someone should probably archive this.


|David Gilbert, PCI, Richmond Hill, Ontario.  | Two things can only be     |
|Mail:                |  equal if and only if they |
|               |   are precisely opposite.  |