File: apcsmart.txt

package info (click to toggle)
nut 2.8.1-5
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 18,284 kB
  • sloc: ansic: 108,785; sh: 9,370; cpp: 3,370; makefile: 2,842; python: 1,029; perl: 763; xml: 47
file content (414 lines) | stat: -rw-r--r-- 14,391 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
APCSMART(8)
===========

NAME
----

apcsmart - Driver for American Power Conversion Smart Protocol UPS equipment

SYNOPSIS
--------

*apcsmart* -h

*apcsmart* -a 'UPS_NAME' [-x option=value ...]

NOTE: This man page only documents the hardware-specific features of the
apcsmart driver. For information about the core driver, see
linkman:nutupsdrv[8].


SUPPORTED HARDWARE
------------------

The apcsmart driver should recognize (or at the very least, work with)
the majority of Smart-UPS models -- which includes Smart-UPS, Matrix-UPS
and Back-UPS lineups, among few other ones.

Currently, we can roughly divide APC hardware into four groups (note
that the division isn't strict by any means, and the borders between
those are pretty fuzzy):

[very] "old" models::
    These models usually have old APC logo, white color and _no_
	programmable EEPROM; you won't find them listed anywhere on APC's
	site either. The support for those will be usually based on driver's
	compatibility tables, or if the model (firmware) is not listed in
	those -- the driver will try to follow the very basic subset of
	features, while still trying to remain useful. Despite "smart"
	tagname, they often tend to behave in pretty dumb way (see the
    section below about shutdown behaviour).
+
--
.Example models:
    * Smart-UPS 2000I
    * Smart-UPS 900I
--

"new" models::
    These models usually come from late 1990s / pre-2009 times.
	They are often referred to as "3rd. gen". For the most part, they
	have programmable EEPROM, report supported commands and capabilities,
	and should work just fine with the apcsmart driver.

"microlink" models::
    WARNING: these are not _natively_ supported by *apcsmart* (or as of
	this writing by *apcupsd*, for that matter, if you're wondering).
	Around 2007, APC (now APC Schneider) decided to go back to its
	proprietary roots, and all the new models (SMT, SMX, SURTD) use
	completely different protocol and cables. If you purchased
    a new APC UPS -- that uses cable with RJ45 on the one end, and DB-9
	on the other -- then you have such model. Your only option to support
	it through *NUT* is to purchase a "legacy communications card" --
	part #AP9620 (google 'AP9620' for more details). Or if that's not
	an option, rely on official software.
	+
	UPDATE: later releases of *apcupsd* claimed support for new APC
	protocols, so it is worth checking if *apcupsd* software would
	work with your device, and *apcupsd-ups* NUT driver would handle
	it as part of NUT-managed ecosystem.

Microsol models::
    Several Microsol serial models sold in Brazil have been rebranded
	as APC Back-UPS, and the model numbers tend to start with "BZ".
	If you have one of these "Nobreaks", they will not work with the
	*apcsmart* driver -- please see the linkman:solis[8] driver instead.
+
--
.Example models:
    * Back-UPS BZ1200-BR
    * Back-UPS BZ2200BI-BR
--

Another thing to remember is that Smart protocol is not USB protocol.
If you have UPS with both USB and serial ports, then depending on how
you connect it, you will need either apcsmart or usbhid-ups driver.

CABLING
-------

This driver expects to see a 940-0024C cable or a clone by default. You
can switch to the 940-0095B dual-mode cable support with the 'cable='
definition described below.

If your 940-xx24X cable is broken or missing, use this diagram to build
a clone:

https://www.networkupstools.org/cables.html#_940_0024c_clone

NOTE:  The "xx" is either "00" for a short cable, or the number of feet
of a longer cable.  The "X" is a letter representing the minor revision
of the physical cable and its connectors ("C" and "E" are commonly found
revisions).  All minor revisions should use the same pin-outs and
wiring.

You can specify alternate cable in linkman:ups.conf[5]:

*cable*=940-0095B

Alternatively, you can also provide it on the command line using:

-x *cable*=940-0095B

TTY MODES
---------

By default the driver works in canonical mode, but it proved to be a
problem in Windows systems. Furthermore there's a possibility of some
obscure serial cards or serial-USB converters that could cause problems
as well. You can use 'ttymode=' option to force non-canonical discipline
in linkman:ups.conf[5]:

*ttymode*=raw

Alternatively, you can also provide it on the command line using:

-x *ttymode*=raw

NOTE: Any other value will make the driver work in the canonical mode.

EXPLANATION OF SHUTDOWN METHODS SUPPORTED BY APC UPSES
------------------------------------------------------

APC hardware supports a lot of shutdown methods, that themselves can
differ in behaviour quite a bit, depending on the model.

*S* (soft hibernate)::
    This is most basic command present in probably all APC models. It will
    hibernate the UPS, and subsequently wake it up when the mains supply
    returns. *The command doesn't work if the UPS is running on mains.*
+
--
    "old" models: ::
        The behaviour here is unfortunately pretty primitive -
		when the power returns, the UPS just wakes up. No grace periods,
		no min. battery charge condition, etc. This is probably not what
		you want.

    "new" models: ::
        The behaviour here is as expected -- the power is cut off after the
        EEPROM defined grace period. The UPS will wake up when the power
        returns, after the EEPROM defined delay AND if the EEPROM defined
		min. battery charge level is met. The delay is counted from the
		power's return.
--
+
*CS* (aka "force OB hack")::
    This is a trick to make UPS power down even if it's running on mains.
    Immediately before issuing *S*, "simulate power failure" is issued.
	The remaining behaviour is as in *S* case.
+
There's a delay between "simulate power failure" and *S* -- by default
set to 3.5s. You can control it through *cshdelay* option (allowed
values are from 0 to 9.9).
+
The name came from APC CS models, where such trick was used to power down
UPSes in consistent fashion using only *S*. It's better to use *@nnn*
command if your UPS supports it (and is not too old, see below).

*@nnn* (hard hibernate)::
    This is basic command used to hibernate UPS regardless if it's
    running on batteries or on mains. The option takes 3 digits argument
	which can be used to specify additional wake-up delay (in 6 minute
	units).
+
--
    "old" models: ::
        The behaviour is -- unfortunately -- similarly primitive to *S*.
		The UPS unconditionally wakes up after $$nnn*6$$ minutes:
		*it doesn't care if the power returned !*
		If nnn = 000, then UPS will do precisely nothing.
		On those models you're better specifying nnn > 0, if you can
		estimate the kind of power problems that might be happening
		in your environment.
        Another thing to consider with "old" models -- you might lose the
        connection with the UPS, until it wakes up (with *S*, the serial
        connection is kept alive).

    "new" models: ::
        All the usual variables defined in EEPROM are respected (see *S*).
        Additionally, if nnn > 0, the $$nnn*6$$ minutes are added to EEPROM
        defined delay. UPS will not power up if it's running on batteries,
        contrary to what "old" models used to do -- the combined delay is
		counted from the moment of power return.
--
+
Supposedly there exist models that take 2 digits instead of 3. Just in case,
NUT also supports such variation. You have to provide exactly 2 digits to
trigger it (*awd* option, or argument to one of the supported instant commands).

*K* (delayed poweroff)::
    This is permanent poweroff -- the UPS will not wake up automatically.
	On newer units, it will respect applicable EEPROM variables.

*Z* (instant poweroff)::
    This is also permanent poweroff -- the UPS will not wake up automatically.
    The poweroff is executed immediately.

SHUTDOWN CONTROL BY NUT
-----------------------

There are three options used to control the shutdown behaviour.

*sdtype*=[0-5]::
    This option takes a single digit (0-5) as an argument. See below for
    details.

*advorder*=no|[0-4]+::
    This option takes string of digits as an argument. Methods listed
	are tried in turn until one of them succeeds. Note that the meaning
	of digits is different from *sdtype*. See below for details.

*awd*=[0-9]{1,3}::
    This option lets you specify additional wake-up delay used by *@*.
	If you provide exactly 2 digits, the driver will try 2 digits
	variation (see previous section for more info).
	Otherwise standard 3 digits variation is used.
	*Note: the time unit is 6 minutes !*

Keep in mind that *sdtype* and *advorder* are mutually exclusive.
If *advorder* is provided, *sdtype* is ignored. If *advorder* is
set to 'no', *sdtype* is used instead.

If nothing is provided, *NUT* will assume *sdtype*=0 -- which is
generally fine for anything not too ancient or not too quirky.

SDTYPE
~~~~~~

The values permitted are from 0 to 5. Only one can be specified.
Anything else will cause apcsmart to exit.

0::
issue soft hibernate (*S*) if the UPS is running on batteries,
otherwise issue hard hibernate (*@*)
1::
issue soft hibernate (*S*) (if on batteries), and if it fails
(or on mains) -- try hard hibernate (*@*)
2::
issue instant poweroff (*Z*)
3::
issue delayed poweroff (*K*)
4::
issue "force OB hack" (*CS*)
5::
issue hard hibernate (*@*)

NOTE: Hard hibernate's additional wake-up delay can be provided by *awd*.

ADVORDER
~~~~~~~~

The argument is either a word 'no', or a string of 1..5 digits in [0..4]
range. Each digit maps to the one of shutdown methods supported by APC UPSes.
Methods listed in this way are tried in order, until one of them succeeds.

If *advorder* is undefined or set to 'no', *sdtype* is used instead.

The mapping is as follows:

[horizontal]
0:: soft hibernate (*S*)
1:: hard hibernate (*@*)
2:: delayed poweroff (*K*)
3:: instant poweroff (*Z*)
4:: "force OB hack" (*CS*)

NOTE: Hard hibernate's additional wake-up delay can be provided by *awd*.

IGNORING LB STATE
-----------------

APC units -- even if they report LB mode -- will not go into shutdown
automatically. This gives us even more control with reference to "when to
actually shutdown PSU". Since version 2.6.2, NUT supports *ignorelb* option
in driver's section of linkman:ups.conf[5]. When such option is in effect,
the core driver will ignore LB state as reported by specific driver and
start shutdown basing the decision _only_ on two conditions:

battery.charge < battery.charge.low

*OR*

battery.runtime < battery.runtime.low

Of course -- if any of the variables are not available, the appropriate
condition is not checked. If you want to explicitly disable one of the
conditions, simply override the right hand variable causing the condition
to always evaluate to false (you can even provide negative numbers).

APC UPSes don't have battery.charge.low -- you will have to define it
if you want to use such condition (prefix the variable with `override.`
or `default.`).

"New" units have battery.runtime.low, but depending on battery quality,
firmware version, calibration and UPS load -- this variable can be
underestimated quite a bit -- especially right after going into OB state.
This in turn can cause LB to be asserted, which under normal conditions
will cause *NUT* to initiate the shutdown. You might want to disable
this condition entirely, when relying on *ignorelb* option (this was
actually the main motivation behind introduction of such feature).

Simple example:
----
[apc]
    ignorelb
    override.battery.charge.low = 15
    override.battery.runtime.low = -1
----

This would cause apcsmart to go into shutdown _only_ if detected
battery charge < 15%. Runtime condition is always false in this example.

You could ask -- why bother ? Well, the reason is already hinted above.
APC units can be very picky about the batteries, and their firmware can
underestimate the remaining runtime (especially right after going into
OB state). *ignorelb* option and *$$override.*$$* let you remain in
control of the UPS, not UPS in control of you.

Furthermore, this allows to specify conditions similarly to how it's done
in apcupsd daemon, so it should be welcome by people used to that software.


SUPPORTED INSTANT COMMANDS
--------------------------

The apcsmart driver exposes following instant commands:

shutdown.return::
executes soft hibernate

shutdown.return cs::
executes "force OB hack"

shutdown.return at:<nbr>::
executes "hard hibernate" with $$<nbr>*6$$ minutes additional wake-up
delay (<nbr> format is the same as of *awd* option)

shutdown.stayoff::
executes "delayed poweroff"

load.off::
executes "instant poweroff"

All the above commands must be issued 2nd time to have any effect
(no less than 3 seconds, and no more than 15 seconds after the initial
call). Those commands are mostly useful for manual testing, when your
machine is not powered by the UPS you're testing.

Other supported commands:

- load.on
- test.panel.start
- test.failure.start
- test.battery.start
- test.battery.stop
- bypass.start
- bypass.stop
- calibrate.start
- calibrate.stop

PREVIOUS DRIVER VERSION
-----------------------

Previous driver is still available as *apcsmart-old*, should there be
any need to use earlier version (bugs, incompatibilities with new
functionality, etc.). In due time, *apcsmart-old* will be phased out
completely, but this won't happen until the new version gets solid
exposure with no pending issues.

BUGS
----

Some older APC UPS models return bogus data in the status register during
a front panel test. This is usually detected and discarded, but some
other unexpected values have occasionally slipped through.

APC UPS models with both USB and serial ports require a power cycle when
switching from USB communication to serial, and perhaps vice versa.

AUTHORS AND HISTORY
-------------------

Nigel Metheringham <Nigel.Metheringham@Intechnology.co.uk> (drawing
heavily on the original `apcsmart` driver by Russell Kroll).

This driver was called `newapc` for a time and was renamed in
the 1.5 series.

In 2.6.2 it was renamed to `apcsmart-old`, being superseded by
updated version with new features, which is maintained by Michal
Soltys <soltys@ziu.info>

SEE ALSO
--------

linkman:nutupsdrv[8], linkman:ups.conf[5], linkman:usbhid-ups[8],
linkman:solis[8]

Internet resources:
~~~~~~~~~~~~~~~~~~~

The NUT (Network UPS Tools) home page: https://www.networkupstools.org/

// vim: tw=80 ai si ts=8 sts=4 sw=4 et :