UPS: apcupsd clean sources
[tomato.git] / release / src / router / apcupsd / doc / manual / smartprotocol.rst
blob8159ff7156322c2e2c744a914b6c74971f74c060
1 APC smart protocol
2 ==================
4 The APC UPS
5 protocol was originally analyzed by Pavel Korensky with additions
6 from Andre H. Hendrick beginning in 1995, and we want to give
7 credit for good, hard work, where credit is due. After having said
8 that, you will see that Steven Freed built much of the original
9 apcupsd information file.
11 The start of this chapter of the apcupsd manual in HTML format was
12 pulled from the Network UPS Tools (NUT) site 
13 (http://www.networkupstools.org/protocols/apcsmart.html). It
14 has been an invaluable tool in improving apcupsd, and I consider it
15 the Bible of APC UPS programming. In the course of using it, I
16 have added information gleaned from apcupsd and information
17 graciously supplied by APC. 
19 Description
20 -----------
22 Here's the information on the elusive APC smart signaling protocol
23 used by their higher end units (Back-UPS Pro, Smart-UPS,
24 Matrix-UPS, etc). What you see here has been collected from a
25 variety of sources. Some people analyzed the chatter between
26 PowerChute and their hardware. Others sent various characters to
27 the UPS and figured out what the results meant.
29 RS-232 differences
30 ------------------
32 Normal 9 pin serial connections have TxD on 3 and RxD on 2. APC's
33 smart serial ports put TxD on pin 1 and RxD on pin 2. This means
34 you go nowhere if you use a normal straight through serial cable.
35 In fact, you might even power down the load if you plug one of
36 those cables in. This is due to the odd routing of pins - DTR and
37 RTS from the PC usually wind up driving the on/off line. So, when
38 you open the port, they go high and \*poof\* your computer dies.
40 The Smart Protocol
41 ------------------
43 Despite the lack of official information from APC, this table has
44 been constructed. It's standard RS-232 serial communications at
45 2400 bps/8N1. Don't rush the UPS while transmitting or it may stop
46 talking to you. This isn't a problem with the normal single
47 character queries, but it really does matter for multi-char things
48 like "@000". Sprinkle a few calls to usleep() in your code and
49 everything will work a lot better.
51 The following table describes the single character "Code" or
52 command that you can send to the UPS, its meaning, and what sort of
53 response the UPS will provide. Typically, the response shown below
54 is followed by a newline (\\n in C) and a carriage return (\\r in
55 C). If you send the UPS a command that it does not recognize or
56 that is not available on your UPS, it will normally respond with "NA"
57 for "not available", otherwise the response is given in the
58 "Typical results" column.
60 +---------+------------+----------------+--------------------------------------+
61 |Character|Meaning     |Typical results |Other info                            |
62 +=========+============+================+======================================+
63 |^A       |Model string|SMART-UPS 700   |Spotty support for this query on older|
64 |         |            |                |models                                |
65 +---------+------------+----------------+--------------------------------------+
66 |^N       |Turn on UPS |n/a             |Send twice, with 1.5s delay between   |
67 |         |            |                |chars. Only on 3rd gen SmartUPS and   |
68 |         |            |                |Black Back-UPS Pros                   |
69 +---------+------------+----------------+--------------------------------------+
70 |^Z       |Permitted   |*long string*   |Gives the EEPROM permitted values for |
71 |         |EEPROM      |                |your model. See `EEPROM Values`_ for  |
72 |         |Values      |                |details.                              |
73 +---------+------------+----------------+--------------------------------------+
74 |A        |Front panel |Light show +    |Also sounds the beeper for 2 seconds  |
75 |         |test        |"OK"            |                                      |
76 +---------+------------+----------------+--------------------------------------+
77 |B        |Battery     |27.87           |Varies based on current level of      |
78 |         |voltage     |                |charge. See also Nominal Battery      |
79 |         |            |                |Voltage.                              |
80 +---------+------------+----------------+--------------------------------------+
81 |C        |Internal    |036.0           |Units are degrees C                   |
82 |         |Temperature |                |                                      |
83 +---------+------------+----------------+--------------------------------------+
84 |D        |Runtime     |!, then $       |Runs until battery is below 25% (35%  |
85 |         |calibration |                |for Matrix) Updates the 'j' values.   |
86 |         |            |                |Only works at 100% battery charge. Can|
87 |         |            |                |be aborted with a second "D"          |
88 +---------+------------+----------------+--------------------------------------+
89 |E        |Automatic   |336             |Writable variable. Possible values:   |
90 |         |self test   |                |                                      |
91 |         |interval    |                |- "336" (14 days)                     |
92 |         |            |                |- "168" (7 days)                      |
93 |         |            |                |- "ON " (at power on) note extra space|
94 |         |            |                |- "OFF" (never)                       |
95 +---------+------------+----------------+--------------------------------------+
96 |F        |Line        |60.00           |Units are Hz. Value varies based on   |
97 |         |frequency   |                |locality, usually 50/60.              |
98 +---------+------------+----------------+--------------------------------------+
99 |G        |Cause of    |O               |Possible values:                      |
100 |         |last        |                |                                      |
101 |         |transfer    |                |- R (unacceptable utility voltage rate|
102 |         |to battery  |                |  of change)                          |
103 |         |            |                |- H (high utility voltage)            |
104 |         |            |                |- L (low utility voltage)             |
105 |         |            |                |- T (line voltage notch or spike)     |
106 |         |            |                |- O (no transfers since turnon)       |
107 |         |            |                |- S (transfer due to U command or     |
108 |         |            |                |  activation of UPS test from front   |
109 |         |            |                |  panel)                              |
110 |         |            |                |- NA (transfer reason still not       |
111 |         |            |                |  available; read again)              |
112 +---------+------------+----------------+--------------------------------------+
113 |I        |Measure-UPS |FF              |*not decoded yet*                     |
114 |         |Alarm enable|                |                                      |
115 +---------+------------+----------------+--------------------------------------+
116 |J        |Measure-UPS |0F,00           |*not decoded yet*                     |
117 |         |Alarm status|                |                                      |
118 +---------+------------+----------------+--------------------------------------+
119 |K        |Shutdown    |OK or *         |Send twice with > 1.5s delay between  |
120 |         |with grace  |                |chars. Older units send "*" instead of|
121 |         |period (no  |                |"OK". Length of grace period is set   |
122 |         |return)     |                |with Grace Period command. UPS will   |
123 |         |            |                |remain off and NOT power on if utility|
124 |         |            |                |power is restored.                    |
125 +---------+------------+----------------+--------------------------------------+
126 |L        |Input line  |118.3           |Value varies based on locality. Does  |
127 |         |voltage     |                |not always read 000.0 on line failure.|
128 +---------+------------+----------------+--------------------------------------+
129 |M        |Maximum line|118.9           |This is the max voltage since the last|
130 |         |voltage     |                |time this query was run.              |
131 +---------+------------+----------------+--------------------------------------+
132 |N        |Minimum line|118.1           |This is the min voltage since the last|
133 |         |voltage     |                |time this query was run.              |
134 +---------+------------+----------------+--------------------------------------+
135 |O        |Output      |118.3           |Also see on battery output voltage.   |
136 |         |voltage     |                |                                      |
137 +---------+------------+----------------+--------------------------------------+
138 |P        |Power load  |023.5           |Relative to capacity of the UPS.      |
139 |         |%           |                |                                      |
140 +---------+------------+----------------+--------------------------------------+
141 |Q        |Status flags|08              |Bitmapped, see `status bits`_ below   |
142 +---------+------------+----------------+--------------------------------------+
143 |R        |Turn dumb   |BYE             |Only on 3rd gen SmartUPS, SmartUPS    | 
144 |         |            |                |v/s, BackUPS Pro. Must send enter     |
145 |         |            |                |smart mode command to resume comms.   |
146 +---------+------------+----------------+--------------------------------------+
147 |S        |Soft        |OK              |Command executes after grace period.  |
148 |         |shutdown    |                |UPS goes online when power returns.   |
149 |         |            |                |Only works when on battery.           |
150 +---------+------------+----------------+--------------------------------------+
151 |U        |Simulate    |!, then $       |See `Alert messages`_ section for info|
152 |         |power       |                |on ! and $.                           |
153 |         |failure     |                |                                      |
154 +---------+------------+----------------+--------------------------------------+
155 |V        |Old firmware|"GWD" or "IWI"  |See `Interpretation of the Old        |
156 |         |revision    |                |Firmware Revision`_                   |
157 +---------+------------+----------------+--------------------------------------+
158 |W        |Self test   |OK              |Tests battery, like pushing button on |
159 |         |            |                |the front panel. Results stored in "X"|
160 +---------+------------+----------------+--------------------------------------+
161 |X        |Self test   |OK              |Possible values:                      |
162 |         |results     |                |                                      |
163 |         |            |                |- OK = good battery                   |
164 |         |            |                |- BT = failed due to insufficient     |
165 |         |            |                |  capacity                            |
166 |         |            |                |- NG = failed due to overload         |
167 |         |            |                |- NO = no results available (no test  |
168 |         |            |                |  performed in last 5 minutes)        |
169 +---------+------------+----------------+--------------------------------------+
170 |Y        |Enter smart |SM              |This must be sent before any other    |
171 |         |mode        |                |commands will work. See also turn dumb|
172 |         |            |                |command to exit smart mode.           |
173 +---------+------------+----------------+--------------------------------------+
174 |Z        |Shutdown    |n/a             |Send twice with > 1.5s delay between  |
175 |         |immediately |                |chars. UPS switches load off          |
176 |         |            |                |immediately (no grace period)         |
177 +---------+------------+----------------+--------------------------------------+
178 |a        |Protocol    |*long string*   |Returns three main sections delimited |
179 |         |info        |                |by periods:                           |
180 |         |            |                |                                      |
181 |         |            |                |- Protocol version                    |
182 |         |            |                |- Alert messages (aka async notifiers)|
183 |         |            |                |- Valid commands                      |
184 +---------+------------+----------------+--------------------------------------+
185 |b        |Firmware    |50.9.D          |See `Interpretation of the New        |
186 |         |revision    |                |Firmware Revision`_.                  |
187 |         |            |                |                                      |
188 |         |            |                |Decoding the example:                 |
189 |         |            |                |                                      |
190 |         |            |                |- 50 = SKU (variable length)          | 
191 |         |            |                |- 9 = firmware revision               |
192 |         |            |                |- D = country code (D=USA,            |
193 |         |            |                |  I=International, A=Asia, J=Japan,   |
194 |         |            |                |  M=Canada)                           |
195 +---------+------------+----------------+--------------------------------------+
196 |c        |UPS local   |UPS_IDEN        |Writable variable. Up to 8 letter     |
197 |         |id          |                |identifier for keeping track of your  |
198 |         |            |                |hardware.                             |
199 +---------+------------+----------------+--------------------------------------+
200 |e        |Return      |00              |Writable variable. Minimum battery    |
201 |         |threshold   |                |charge % before UPS will return online|
202 |         |            |                |after a soft shutdown. Possible       |
203 |         |            |                |values:                               |
204 |         |            |                |                                      |
205 |         |            |                |- 00 = 00% (UPS turns on immediately) |
206 |         |            |                |- 01 = 15%                            |
207 |         |            |                |- 02 = 25%                            |
208 |         |            |                |- 03 = 90%                            |
209 +---------+------------+----------------+--------------------------------------+
210 |f        |Battery     |099.0           |Percentage of battery charge remaining|
211 |         |level %     |                |                                      |
212 +---------+------------+----------------+--------------------------------------+
213 |g        |Nominal     |024             |The battery voltage that's expected to|
214 |         |battery     |                |be present in the UPS normally. This  |
215 |         |voltage     |                |is a constant based on the type,      |
216 |         |            |                |number, and wiring of batteries in the|
217 |         |            |                |UPS. Typically "012", "024" or "048". |
218 +---------+------------+----------------+--------------------------------------+
219 |h        |Measure-UPS |042.4           |Percentage. Only works on models with |
220 |         |ambient     |                |Measure-UPS SmartSlot card.           |
221 |         |humidity (%)|                |                                      |
222 +---------+------------+----------------+--------------------------------------+
223 |i        |Measure-UPS |00              |Bitmapped hex variable. Mapping:      |
224 |         |dry contacts|                |                                      |
225 |         |            |                |- 10 = contact 1                      |
226 |         |            |                |- 20 = contact 2                      |
227 |         |            |                |- 40 = contact 3                      |
228 |         |            |                |- 80 = contact 4                      |
229 +---------+------------+----------------+--------------------------------------+
230 |j        |Estimated   |0327:           |Value is in minutes. Terminated with  |
231 |         |runtime     |                |a colon.                              |
232 +---------+------------+----------------+--------------------------------------+
233 |k        |Alarm delay |0               |Writable variable. Controls behavior  |
234 |         |            |                |of UPS beeper. Possible values:       |
235 |         |            |                |                                      |
236 |         |            |                |- 0 = 5 second delay after power fail |
237 |         |            |                |- T = 30 second delay                 |
238 |         |            |                |- L = alarm at low battery only       |
239 |         |            |                |- N = no alarm                        |
240 +---------+------------+----------------+--------------------------------------+
241 |l        |Low transfer|103             |Writable variable. UPS goes on battery|
242 |         |voltage     |                |when voltage drops below this point.  |
243 +---------+------------+----------------+--------------------------------------+
244 |m        |Manufacture |11/29/96        |Format may vary by country (MM/DD/YY  |
245 |         |date        |                |vs DD/MM/YY). Unique within groups of |
246 |         |            |                |UPSes (production runs)               |
247 +---------+------------+----------------+--------------------------------------+
248 |n        |Serial      |WS9643050926    |Unique for each UPS                   |
249 |         |number      |                |                                      |
250 +---------+------------+----------------+--------------------------------------+
251 |o        |Nominal     |115             |Expected output voltage when running  |
252 |         |Output      |                |on batteries. May be a writable       |
253 |         |Voltage     |                |variable on 220/230/240 VAC units.    |
254 +---------+------------+----------------+--------------------------------------+
255 |p        |Shutdown    |020             |Seconds. Writable variable. Sets the  |
256 |         |grace delay |                |delay before soft shutdown completes. |
257 |         |            |                |(020/180/300/600)                     |
258 +---------+------------+----------------+--------------------------------------+
259 |q        |Low battery |02              |Minutes. Writable variable. The UPS   |
260 |         |warning     |                |will report a low battery condition   |
261 |         |            |                |this many minutes before it runs out  |
262 |         |            |                |of power                              |
263 +---------+------------+----------------+--------------------------------------+
264 |r        |Wakeup delay|000             |Seconds. Writable variable. The UPS   |
265 |         |            |                |will wait this many seconds after     |
266 |         |            |                |reaching the minimum charge before    |
267 |         |            |                |returning online. (000/060/180/300)   |
268 +---------+------------+----------------+--------------------------------------+
269 |s        |Sensitivity |H               |Writable variable. Possible values:   |
270 |         |            |                |                                      |
271 |         |            |                |- H = highest                         |
272 |         |            |                |- M = medium                          |
273 |         |            |                |- L = lowest                          |
274 |         |            |                |- A = autoadjust (Matrix only)        |
275 +---------+------------+----------------+--------------------------------------+
276 |t        |Measure-UPS |80.5            |Degrees C. Only works on models with  |
277 |         |ambient     |                |the Measure-UPS SmartSlot card.       |
278 |         |temperature |                |                                      |
279 +---------+------------+----------------+--------------------------------------+
280 |u        |Upper       |132             |Writable variable. UPS goes on battery|
281 |         |transfer    |                |when voltage rises above this point.  |
282 |         |voltage     |                |                                      |
283 +---------+------------+----------------+--------------------------------------+
284 |v        |Measure-UPS |4Kx             |Firmware information for Measure-UPS  |
285 |         |firmware    |                |board                                 |
286 +---------+------------+----------------+--------------------------------------+
287 |x        |Last battery|11/29/96        |Writable variable. Holds whatever the |
288 |         |change date |                |user set in it. Eight characters.     |
289 +---------+------------+----------------+--------------------------------------+
290 |y        |Copyright   |\(C) APCC       |Only works if firmware letter is      |
291 |         |notice      |                |later than O                          |
292 +---------+------------+----------------+--------------------------------------+
293 |z        |Reset to    |CLEAR           |Resets most variables to initial      |
294 |         |factory     |                |factory values except identity or     |
295 |         |settings    |                |battery change date. Not available on |
296 |         |            |                |SmartUPS v/s or BackUPS Pro.          |
297 +---------+------------+----------------+--------------------------------------+
298 |\+       |Capability  |*various*       |Cycle forward through possible        |
299 |         |cycle       |                |capability values. UPS sends          |
300 |         |(forward)   |                |afterward to confirm change to EEPROM.|
301 +---------+------------+----------------+--------------------------------------+
302 |\-       |Capability  |*various*       |Cycle backward through possible       |
303 |         |cycle       |                |capability values. UPS sends          |
304 |         |(backward)  |                |afterward to confirm change to EEPROM.|
305 +---------+------------+----------------+--------------------------------------+
306 |@nnn     |Shutdown and|OK or *         |UPS shuts down after grace period with|
307 |         |return      |                |delayed wakeup after nnn tenths of an |
308 |         |            |                |hour plus any wakeup delay time. Older|
309 |         |            |                |models send "*" instead of "OK".      |
310 +---------+------------+----------------+--------------------------------------+
311 |0x7f     |Abort       |OK              |Use to abort @, S, K                  |
312 |         |shutdown    |                |                                      |
313 +---------+------------+----------------+--------------------------------------+
314 |~        |Register #1 |*see below*     |See `Register 1`_ table               |
315 +---------+------------+----------------+--------------------------------------+
316 |'        |Register #2 |*see below*     |See `Register 2`_ table               |
317 +---------+------------+----------------+--------------------------------------+
318 |0        |Battery     |                |See `Resetting the UPS Battery        |
319 |         |constant    |                |Constant`_                            |
320 +---------+------------+----------------+--------------------------------------+
321 |4        |*???*       |                |Prints 35 on SmartUPS 1000            |
322 +---------+------------+----------------+--------------------------------------+
323 |5        |*???*       |                |Prints EF on SmartUPS 1000            |
324 +---------+------------+----------------+--------------------------------------+
325 |6        |*???*       |                |Prints F9 on SmartUPS 1000            |
326 +---------+------------+----------------+--------------------------------------+
327 |7        |DIP switch  |                |See `Dip switch info`_                |
328 |         |positions   |                |                                      |
329 +---------+------------+----------------+--------------------------------------+
330 |8        |Register #3 |*see below*     |See `Register 3`_ table               |
331 +---------+------------+----------------+--------------------------------------+
332 |9        |Line quality|FF              |Possible values:                      |
333 |         |            |                |                                      |
334 |         |            |                |- 00 = unacceptable                   |
335 |         |            |                |- FF = acceptable                     |
336 +---------+------------+----------------+--------------------------------------+
337 |>        |Number of   |                |SmartCell models return number of     |
338 |         |external    |                |connected packs. Other models return  |
339 |         |battery     |                |value set by the user (use +/-).      |
340 |         |packs       |                |                                      |
341 +---------+------------+----------------+--------------------------------------+
342 |[        |Measure-UPS |NO,NO           |Degrees C. Writable Variable. Possible|
343 |         |Upper temp  |                |values: 55, 50, 45, ..., 05.          |
344 |         |limit       |                |Use +/- to change values.             |
345 +---------+------------+----------------+--------------------------------------+
346 |]        |Measure-UPS |NO,NO           |Degrees C. Writable Variable. Possible|
347 |         |lower temp  |                |values: 55, 50, 45, ..., 05.          |
348 |         |limit       |                |Use +/- to change values.             |
349 +---------+------------+----------------+--------------------------------------+
350 |{        |Measure-UPS |NO,NO           |Percentage. Writable Variable.        |
351 |         |Upper       |                |Possible values: 90, 80, 70, ..., 10. |
352 |         |humidity    |                |Use +/- to change values.             |
353 |         |limit       |                |                                      |
354 +---------+------------+----------------+--------------------------------------+
355 |}        |Measure-UPS |NO,NO           |Percentage. Writable Variable.        |
356 |         |lower       |                |Possible values: 90, 80, 70, ..., 10. |
357 |         |humidity    |                |Use +/- to change values.             |
358 |         |limit       |                |                                      |
359 +---------+------------+----------------+--------------------------------------+
360 |**Matrix-UPS and Symmetra Commands**                                          |
361 +---------+------------+----------------+--------------------------------------+
362 |^        |Run in      |BYP, INV, ERR   |If online, "BYP" response is received |
363 |         |bypass mode |                |as bypass mode starts. If already in  |
364 |         |            |                |bypass, "INV" is received and UPS goes|
365 |         |            |                |online. If UPS can't transfer, "ERR"  |
366 |         |            |                |received                              |
367 +---------+------------+----------------+--------------------------------------+
368 |<        |Number of   |000             |Count of bad packs connected to the   |
369 |         |bad battery |                |UPS                                   |
370 |         |packs       |                |                                      |
371 +---------+------------+----------------+--------------------------------------+
372 |/        |Load current|*nn.nn*         |True RMS load current drawn by UPS    |
373 +---------+------------+----------------+--------------------------------------+
374 |\\       |Apparent    |*nnn.nn*        |Output load as percentage of full     |
375 |         |load power  |                |rated load in VA.                     |
376 +---------+------------+----------------+--------------------------------------+
377 |^V       |Output      |                |Writable variable. Possible values:   |
378 |         |voltage     |                |                                      |
379 |         |selection   |                |- A = automatic (based on input tap)  |
380 |         |            |                |- M = 208 VAC                         |
381 |         |            |                |- I = 240 VAC                         |
382 +---------+------------+----------------+--------------------------------------+
383 |^L       |Front panel |                |Writable variable. Possible values:   |
384 |         |language    |                |                                      |
385 |         |            |                |- E = English                         |
386 |         |            |                |- F = French                          |
387 |         |            |                |- G = German                          |
388 |         |            |                |- S = Spanish                         |
389 |         |            |                |- 1 = *unknown*                       |
390 |         |            |                |- 2 = *unknown*                       |
391 |         |            |                |- 3 = *unknown*                       |
392 |         |            |                |- 4 = *unknown*                       |
393 +---------+------------+----------------+--------------------------------------+
394 |w        |Run time    |                |Writable variable. Minutes of runtime |
395 |         |conservation|                |to leave in battery (UPS shuts down   |
396 |         |            |                |"early"). Possible values:            |
397 |         |            |                |                                      |
398 |         |            |                |- NO = disabled                       |
399 |         |            |                |- 02 = leave 2 minutes of runtime     |
400 |         |            |                |- 05 = leave 5 minutes                |
401 |         |            |                |- 08 = leave 8 minutes                |
402 +---------+------------+----------------+--------------------------------------+
405 Dip switch info
406 ---------------
408 === ====== =====================================================================
409 Bit Switch Option when bit=1
410 === ====== =====================================================================
411 0   4      Low battery alarm changed from 2 to 5 mins. Autostartup disabled on 
412            SU370ci and 400
413 1   3      Audible alarm delayed 30 seconds
414 2   2      Output transfer set to 115 VAC (from 120 VAC) or to 240 VAC (from 
415            230 VAC)
416 3   1      UPS desensitized - input voltage range expanded
417 4-7        Unused at this time
418 === ====== =====================================================================
421 Status bits
422 -----------
424 This is probably the most important register of the UPS, which
425 indicates the overall UPS status. Some common things you'll see:
427 - 08 = On line, battery OK
428 - 10 = On battery, battery OK
429 - 50 = On battery, battery low
430 - SM = Status bit is still not available (retry reading)
432 === ============================================================================
433 Bit Meaning when bit=1
434 === ============================================================================
435 0   Runtime calibration occurring
436     (Not reported by Smart UPS v/s and BackUPS Pro)
437 1   SmartTrim (Not reported by 1st and 2nd generation SmartUPS models)
438 2   SmartBoost
439 3   On line (this is the normal condition)
440 4   On battery
441 5   Overloaded output
442 6   Battery low
443 7   Replace battery
444 === ============================================================================
447 Alert messages
448 --------------
450 These single character messages are sent by the UPS any time there
451 is an Alert condition. All other responses indicated above are sent
452 by the UPS only in response to a query or action command.
454 ========= ============= ========================================================
455 Character Meaning       Description
456 ========= ============= ========================================================
457 !         Line Fail     Sent when the UPS goes on-battery, repeated  every 30
458                         seconds until low battery condition reached. Sometimes 
459                         occurs more than once in the first 30 seconds.
461 $         Return from   UPS back on line power. Only sent if a ! has been sent
462           line fail     previously.
463                                 
464 %         Low battery   Sent to indicate low battery. Not implemented on 
465                         SmartUPS v/s or BackUPS Pro models
467 \+        Return from   Sent when the battery has been recharged to some level
468           low batt      Only sent if a % has been sent previously.
470 ?         Abnormal      Sent for conditions such as "shutdown due to overload"
471           condition     or "shutdown due to low battery  capacity". Also occurs 
472                         within 10 minutes of turnon.
474 =         Return from   Sent when the UPS returns from an abnormal condition
475           abnormal      where ? was sent, but not a turn-on. Not implemented on
476           condition     SmartUPS v/s or BackUPS Pro models.
478 \*        About to      Sent when the UPS is about to switch off the load. No
479           turn off      commands are processed after this character is sent. Not
480                         implemented on SmartUPS v/s, BackUPS Pro, or 3rd 
481                         generation SmartUPS models.
483 #         Replace       Sent when the UPS detects that the battery needs to be
484           battery       replaced. Sent every 5 hours until a new battery test is
485                         run or the UPS is shut off. Not implemented on SmartUPS 
486                         v/s or BackUPS Pro models.
488 &         Check alarm   Sent to signal that temp or humidity out of set limits.
489           register      Also sent when one of the contact closures changes 
490           for fault     state. Sent every 2 minutes until the alarm conditions
491           (Measure-UPS) are reset. Only sent for alarms enabled with I. Cause of
492                         alarm may be determined with J. Not implemented on 
493                         SmartUPS v/s or BackUPS Pro.
495 \|        Variable      Sent whenever any EEPROM variable is changed. Only
496           change in     supported on Matrix UPS and 3rd generation SmartUPS 
497           EEPROM        models.
498 ========= ============= ========================================================
501 Register 1
502 ----------
504 All bits are valid on the Matrix UPS. SmartUPS models only support
505 bits 6 and 7. Other models do not respond.
507 === ============================================================================
508 Bit Meaning when bit=1
509 === ============================================================================
510 0   In wakeup mode (typically lasts < 2s)
511 1   In bypass mode due to internal fault (see `Register 2`_ or `Register 3`_)
512 2   Going to bypass mode due to command
513 3   In bypass mode due to command
514 4   Returning from bypass mode
515 5   In bypass mode due to manual bypass control
516 6   Ready to power load on user command
517 7   Ready to power load on user command or return of line power
518 === ============================================================================
521 Register 2
522 ----------
524 Matrix UPS models report bits 0-5. SmartUPS models only support
525 bits 4-6. SmartUPS v/s and BackUPS Pro report bits 4, 6, 7.
526 Unused bits are set to 0. Other models do not respond.
528 === ============================================================================
529 Bit Meaning when bit=1
530 === ============================================================================
531 0   Fan failure in electronics, UPS in bypass 
532 1   Fan failure in isolation unit
533 2   Bypass supply failure
534 3   Output voltage select failure, UPS in bypass 
535 4   DC imbalance, UPS in bypass
536 5   Battery is disconnected
537 6   Relay fault in SmartTrim or SmartBoost
538 7   Bad output voltage
539 === ============================================================================
542 Register 3
543 ----------
545 All bits are valid on the Matrix UPS and 3rd generation SmartUPS
546 models. SmartUPS v/s and BackUPS Pro models report bits 0-5. All
547 others report 0-4. State change of bits 1,2,5,6,7 are reported
548 asynchronously with ? and = messages.
550 === ============================================================================
551 Bit Meaning when bit=1
552 === ============================================================================
553 0   Output unpowered due to shutdown by low battery
554 1   Unable to transfer to battery due to overload
555 2   Main relay malfunction - UPS turned off
556 3   In sleep mode from @ command (maybe others)
557 4   In shutdown mode from S command
558 5   Battery charger failure
559 6   Bypass relay malfunction
560 7   Normal operating temperature exceeded
561 === ============================================================================
564 Interpretation of the Old Firmware Revision
565 -------------------------------------------
567 The Old Firmware Revision is obtained with the "V" command, which
568 gives a typical response such as "GWD" or "IWI", and can be
569 interpreted as follows:
573     Old Firmware revision and model ID String for SmartUPS & MatrixUPS
575     This is a three character string XYZ
577        where X == Smart-UPS or Matrix-UPS ID Code.
578          range 0-9 and A-P
579            1 == unknown
580            0 == Matrix 3000
581            5 == Matrix 5000
582          the rest are Smart-UPS and Smart-UPS-XL
583            2 == 250       3 == 400       4 == 400
584            6 == 600       7 == 900       8 == 1250
585            9 == 2000      A == 1400      B == 1000
586            C == 650       D == 420       E == 280
587            F == 450       G == 700       H == 700XL
588            I == 1000      J == 1000XL    K == 1400
589            L == 1400XL    M == 2200      N == 2200XL
590            O == 3000      P == 5000
592        where Y == Possible Level of Smart Features, unknown???
593            G == Stand Alone
594            T == Stand Alone
595                    V == ???
596            W == Rack Mount
598        where Z == National Model Use Only Codes
599            D == Domestic        115 Volts
600            I == International   230 Volts
601            A == Asia ??         100 Volts
602            J == Japan ??        100 Volts
605 Interpretation of the New Firmware Revision
606 -------------------------------------------
610     New Firmware revision and model ID String in NN.M.L is the format
612         where NN == UPS ID Code.
613             12 == Back-UPS Pro 650
614             13 == Back-UPS Pro 1000
615             52 == Smart-UPS 700
616             60 == SmartUPS 1000
617             72 == Smart-UPS 1400
619             where NN now Nn has possible meanings.
620                 N  == Class of UPS
621                 1n == Back-UPS Pro
622                 5n == Smart-UPS
623                 7n == Smart-UPS NET
625                  n == Level of intelligence
626                 N1 == Simple Signal, if detectable WAG(*)
627                 N2 == Full Set of Smart Signals
628                 N3 == Micro Subset of Smart Signals
630         where M == Possible Level of Smart Features, unknown???
631             1 == Stand Alone
632             8 == Rack Mount
633             9 == Rack Mount
635         where L == National Model Use Only Codes
636             D == Domestic        115 Volts
637             I == International   230 Volts
638             A == Asia ??         100 Volts
639             J == Japan ??        100 Volts
640             M == North America   208 Volts (Servers)
642 EEPROM Values
643 -------------
645 Upon sending a ^Z, your UPS will probably spit back approximately
646 254 characters something like the following (truncated here for the
647 example):
651     #uD43132135138129uM43229234239224uA43110112114108 ....
653 It looks bizarre and ugly, but is easily parsed. The # is some kind
654 of marker/ident character. Skip it. The rest fits this form:
656 -  Command character - use this to select the value
658 -  Locale - use 'b' to find out what yours is (the last character),
659    '4' applies to all
661 -  Number of choices - '4' means there are 4 possibilities coming
662    up
664 -  Choice length - '3' means they are all 3 chars long
666 Then it's followed by the choices, and it starts over. 
668 Matrix-UPS models have ## between each grouping for some reason.
670 Here is an example broken out to be more readable:
674     CMD DFO RSP FSZ FVL
675     u   D   4   3   127 130 133 136
676     u   M   4   3   229 234 239 224
677     u   A   4   3   108 110 112 114
678     u   I   4   3   253 257 261 265
679     l   D   4   3   106 103 100 097
680     l   M   4   3   177 172 168 182
681     l   A   4   3   092 090 088 086
682     l   I   4   3   208 204 200 196
683     e   4   4   2   00   15  50  90
684     o   D   1   3   115
685     o   J   1   3   100
686     o   I   1   3   230 240 220 225
687     o   M   1   3   208
688     s   4   4   1     H   M   L   L
689     q   4   4   2    02  05  07  10
690     p   4   4   3   020 180 300 600
691     k   4   4   1     0   T   L   N
692     r   4   4   3   000 060 180 300
693     E   4   4   3   336 168  ON OFF
695     CMD == UPSlink Command.
696         u = upper transfer voltage
697         l = lower transfer voltage
698         e = return threshold
699         o = output voltage
700         s = sensitivity
701         p = shutdown grace delay
702         q = low battery warning
703         k = alarm delay
704         r = wakeup delay
705         E = self test interval
707     DFO == (4)-all-countries (D)omestic (I)nternational (A)sia (J)apan
708          (M) North America - servers.
709     RSP == Total number possible answers returned by a given CMD.
710     FSZ == Max. number of field positions to be filled.
711     FVL == Values that are returned and legal.
712          
714 Programming the UPS EEPROM
715 --------------------------
717 There are at this time a maximum of 12 different values that can be
718 programmed into the UPS EEPROM. They are:
720 ======= ========================================================================
721 Command Meaning
722 ======= ========================================================================
723 c       The UPS Id or name
724 x       The last date the batteries were replaced
725 u       The Upper Transfer Voltage
726 l       The Lower Transfer Voltage
727 e       The Return Battery Charge Percentage
728 o       The Output Voltage when on Batteries
729 s       The Sensitivity to Line Quality
730 p       The Shutdown Grace Delay
731 q       The Low Battery Warning Delay
732 k       The Alarm Delay
733 r       The Wakeup Delay
734 E       The Automatic Self Test Interval
735 ======= ========================================================================
737 The first two cases (Ident and Batt date) are somewhat special in
738 that you tell the UPS you want to change the value, then you supply
739 8 characters that are saved in the EEPROM. The last ten item are
740 programmed by telling the UPS that you want it to cycle to the next
741 permitted value.
743 In each case, you indicate to the UPS that you want to change the
744 EEPROM by first sending the appropriate query command (e.g. "c" for
745 the UPS ID or "u" for the Upper Transfer voltage. This command is
746 then immediately followed by the cycle EEPROM command or "-". In
747 the case of the UPS Id or the battery date, you follow the cycle
748 command by the eight characters that you want to put in the EEPROM.
749 In the case of the other ten items, there is nothing more to
750 enter.
752 The UPS will respond by "OK" and approximately 5 seconds later by a
753 vertical bar (\|) to indicate that the EEPROM was changed.