APCSMART(8) | NUT Manual | APCSMART(8) |
apcsmart - Driver for American Power Conversion Smart Protocol UPS equipment
apcsmart -h
apcsmart -a UPS_NAME [-x option=value ...]
This man page only documents the hardware-specific features of the apcsmart driver. For information about the core driver, see nutupsdrv(8).
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
Example models:
"new" models
"microlink" models
Microsol models
Example models:
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.
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:
http://www.networkupstools.org/cables.html#_940_0024c_clone
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 ups.conf(5):
cable=940-0095B
Alternatively, you can also provide it on the command line using:
-x cable=940-0095B
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 ups.conf(5):
ttymode=raw
Alternatively, you can also provide it on the command line using:
-x ttymode=raw
Any other value will make the driver work in the canonical mode.
APC hardware supports a lot of shutdown methods, that themselves can differ in behaviour quite a bit, depending on the model.
S (soft hibernate)
"old" models:
"new" models:
CS (aka "force OB hack")
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)
"old" models:
"new" models:
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)
Z (instant poweroff)
There are three options used to control the shutdown behaviour.
sdtype=[0-5]
advorder=no|[0-4]+
awd=[0-9]{1,3}
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.
The values permitted are from 0 to 5. Only one can be specified. Anything else will cause apcsmart to exit.
0
1
2
3
4
5
Hard hibernate’s additional wake-up delay can be provided by awd.
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:
0 | soft hibernate (S) |
1 | hard hibernate (@) |
2 | delayed poweroff (K) |
3 | instant poweroff (Z) |
4 | "force OB hack" (CS) |
Hard hibernate’s additional wake-up delay can be provided by awd.
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 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.
The apcsmart driver exposes following instant commands:
shutdown.return
shutdown.return cs
shutdown.return at:<nbr>
shutdown.stayoff
load.off
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:
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.
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.
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>
nutupsdrv(8), ups.conf(5), usbhid-ups(8), solis(8)
The NUT (Network UPS Tools) home page: http://www.networkupstools.org/
01/25/2023 | Network UPS Tools 2.8.0 |