NAME
ragtech - Driver for Ragtech UPS units (USB CDC-ACM)
SYNOPSIS
ragtech -h
ragtech -a UPS_NAME [OPTIONS]
|
Note
|
This man page only documents the hardware-specific features of the ragtech driver. For information about the core driver, see nutupsdrv(8). |
SUPPORTED HARDWARE
Targets Ragtech UPSes that expose a USB CDC-ACM serial interface
(USB VID 0x04D8, PID 0x000A — Microchip PIC with CDC firmware).
The device shows up under Linux as /dev/ttyACM*.
Validated end-to-end against the Ragtech Easy 2000 TI (model id 16 in the family-10 device table). The other 19 models in the same table — Easy 600/700/900/1200/1300/1400/1600/1800/2000/2200 in both TI (115 V) and M2 (220 V) variants, also sold under the NEP, TORO, INNERGIE and OneUP brands in Brazil — share the same wire protocol and register layout and are expected to work; please report results.
Units from other Ragtech lines that share the same USB id (for example the Easy Pro "GT" series) speak the same protocol but may report a model id that collides with a table entry, so the driver can pick the wrong VA rating. Use the va option below to set the correct rating in that case.
Also validated end-to-end, including a full discharge and recharge used to
calibrate the runtime model below, against a Ragtech New Easy Pro 3200 VA
(part number 20NEP4061, CbU/Ti: automatic 115/127/220 V input, 115 V
output, internal 2x 12 V 9 Ah bank, quick connector for external battery
modules, firmware 1.0). This unit reports model id 18 and is therefore
identified as an Easy 2200 TI; set va = 3200 so that
ups.power.nominal (3200), ups.realpower.nominal (2240) and ups.load
are correct. The 2200 TI output current scaling matched both the unit’s
front-panel load display and the firmware’s own load register (0x8D)
within one percentage point, so no iout_calib override was needed.
On this unit the firmware raises LB at about 21.7 V under load, then
beeps, shows A00 on the display and starts a 30 second shutdown
countdown; the output is cut roughly 60 seconds after LB, whatever the
charge byte (about 30 % at LB, 13 % at the countdown) says. Use
runtime_low so that hosts shut down before that point.
A second protocol, "family 14", covers the Ragtech Easy Way units (21 models, Easy Way 500/600/700/1200/1300/1400/1600 in TI, M1 and M2 variants). They use the same USB ids but a different, push-only protocol; see the FAMILY 14 (EASY WAY) section below. Support for family 14 is read-only and was developed from captures of the OEM software on one unit (an Easy Way TI 1400, sold as "Easy Way 1500 VA GT"); the other 20 models come from the OEM device table only.
This driver is experimental. Polling, status decoding and the
shutdown.stayoff / shutdown.stop instant commands have been
verified on hardware; shutdown.return and test.battery.start.deep
are implemented but not yet verified end-to-end (see the
allow_shutdown note below). The beeper-control wire encoding has
not been reverse-engineered yet.
EXTRA ARGUMENTS
This driver supports the following options in the ups.conf:
- family=auto|10|14
-
Select the protocol family. The default, auto, first listens for a few seconds without writing anything to the UPS: if it receives a checksum-valid family 14 frame at 2560 baud, the unit is treated as family 14; otherwise the driver continues with the family 10 protocol, with the serial settings it had before the listen.
Set family=10 on an Easy Pro unit to skip the listen (and its start-up delay of about three seconds, which also applies to
-k) and to leave the port settings exactly as earlier versions did.Set family=14 to require the Easy Way protocol; owners of an Easy Way unit are advised to do so, because if the automatic listen ever misses the stream, the driver falls back to polling it with family 10 commands, which that protocol does not use.
- iout_calib=number
-
Per-unit output current calibration constant:
output.currentis computed as raw reading times a per-model constant divided by iout_calib. If omitted (default), the driver reads the value from register0xF3at startup; when set, this value takes precedence and the register value is only logged. Set this only to override a wrong factory-stored calibration.Rebadged units are the known case. On a "One Up Nitro 2000" — whose firmware reports the Easy 2000 TI model id — register
0xF3holds70where140is correct, sooutput.current,ups.loadand the implied output VA all come out exactly twice the real value. Ifups.loadlooks too high, and especially if the implied output power exceeds what the whole unit draws from the wall, compareoutput.currentagainst a clamp meter on the UPS output (or against a load of known consumption) and set iout_calib so that the reported current matches. - va=number
-
Override the apparent-power (VA) rating of the unit. The model id byte reported by the firmware is shared between some product lines (for example a 3200 VA "GT" unit reports the same id as the Easy 2200 TI), so the driver cannot always tell them apart and may pick the wrong VA rating from its model table. Setting va to the nameplate rating corrects
ups.power.nominal,ups.realpower.nominal(VA times the 0.7 power factor) and the computedups.load.On family 14 (Easy Way) va only corrects
ups.power.nominal, for units that report another model (for example an Easy Way 1500 GT, which identifies itself as the Easy Way 1400 TI);ups.realpower.nominalis not published there andups.loaddoes not depend on it. - runtimecal=runtime_high,load_high,runtime_low,load_low
-
Enable a calculated
battery.runtime(the firmware reports none). Two points of full-bank runtime in seconds at a givenups.loadin percent, with the same meaning as in nutdrv_qx(8); the driver fitsruntime = k * load^-nthrough them. With this set,battery.chargebecomes the driver’s own state-of-charge estimate: it integrates the energy drawn while on battery and recovers along chargetime on mains, because the firmware charge byte is derived from battery voltage (it reads 100 % as soon as the charger floats the bank, drops sharply under inverter load and was still around 30 % when the firmware raised low battery on the unit this was calibrated on). The raw firmware value is published asbattery.charge.approx. The load behindbattery.runtimeis averaged over about 5 minutes on mains, so that short spikes do not swing the forecast, and over about 15 seconds on battery. See CALIBRATING THE RUNTIME MODEL below. - chargetime=seconds
-
Time to recharge the bank from empty to 80 % (default 28800, the datasheet figure). The last 20 % is assumed to take half as long again, so a full recharge takes 1.5 times this value.
- battery_ah=number
-
Internal bank capacity in Ah (default 9).
- extbatt_ah=number
-
Capacity in Ah of the external battery module(s), at the bank voltage (default 0). Runtime scales by (battery_ah + extbatt_ah) / battery_ah.
- obload_factor=number
-
On mains, multiply
ups.loadby this factor when computingbattery.runtime(default 1.0). The inverter draws noticeably more than the mains path for the same equipment, so without it the estimate shown on mains is optimistic. Measure it as on-battery load divided by on-mains load. - runtime_low=seconds
-
On battery, raise
LBonce the estimated runtime drops below this value (default 300), so upsmon(8) can shut down before the firmware low-battery signal. Also published asbattery.runtime.low. - soc_save_interval=seconds
-
How often the driver’s state-of-charge estimate is saved to the state path (default 60); it is also saved on every mains/battery transition and when the driver exits. Set to 0 to neither save nor resume it. See STATE OF CHARGE FILE below.
- allow_shutdown
-
Enable the
shutdown.return,shutdown.stayoff,shutdown.stopandtest.battery.start.deepandtest.battery.stopinstant commands. Disabled by default for safety: the Easy 2000 TI firmware does not auto-restart after a coordinated shutdown, so anupsmon-driven shutdown on low battery will leave the UPS (and everything plugged into it) powered off until someone presses the physical power button. Only set this flag if you have an out-of-band way to power the UPS back up, or if you are deliberately running a UPS that should stay off after a critical- battery event. With this flag unset,upsdrv_shutdownlogs the refusal and exits with failure instead of cutting the output.
CALIBRATING THE RUNTIME MODEL
The model needs two runtime points, the charge time and, optionally, the on-battery load factor. The procedure below is the one used on the Easy Pro 3200 VA mentioned above; one discharge and one recharge are enough.
Preparation. Keep the UPS on mains for at least 8 hours so the bank is full. Stop upsmon(8) (or set runtime_low to 0 and restart the driver) so the host does not shut down during the test, and keep the normal load connected. Log the driver variables every few seconds, for example:
while :; do
echo "$(date +%T) $(upsc ragtech@localhost 2>/dev/null |
grep -E '^(ups\.(status|load|temperature)|battery\.voltage):' |
paste -sd' ' -)"
sleep 5
done >> discharge.log
Discharge. Disconnect the UPS from the wall and let it run until the
firmware raises LB, then restore mains power immediately: the output is
cut about one minute later. Also abort (restore mains) if the unit reports
a fault or over-temperature, or if battery.voltage falls below 10.5 V
per 12 V block (21.0 V for a 24 V bank). The inverter is audibly louder
than on mains and the internal temperature rose from 50 to 64 C during the
test; the fan cycles at around 63 C.
Recharge. Keep logging battery.voltage (once a minute is enough) after
mains returns. The charger holds a constant current (bulk) while the
voltage rises, raises the bank to its absorption voltage (28.4 to 28.5 V
here) and then drops back to float (about 26.8 V). The float transition
marks a full bank.
Deriving the parameters.
-
runtimecal: the time from disconnection to
LBand the averageups.loadwhile on battery form one point; derive the second from the datasheet autonomy table (scaled to the measured point) or from a second run at a different load. -
obload_factor: average
ups.loadon battery divided by the average on mains before the test. -
chargetime: the time from mains return to the float transition, divided by 1.5.
Measured on the Easy Pro 3200 VA (internal bank only): 1796 s from
disconnection to LB at an average 11.4 % load on battery (9.2 % on mains
before the test); bulk charge for 4.1 hours at about 1.5 A, float reached
6.4 hours after mains returned. The resulting settings:
va = 3200
runtimecal = 1796,11.4,5592,5.0
chargetime = 15300
obload_factor = 1.24
The second runtimecal point keeps the exponent derived from the Ragtech datasheet table (80 minutes at about 110 W, 20 minutes at about 300 W). These values come from a brand new unit with its factory batteries, calibrated within days of purchase; older batteries deliver noticeably less. Repeat the discharge after adding external modules (and set extbatt_ah), and about once a year as the batteries age.
STATE OF CHARGE FILE
With runtimecal set, the driver keeps its state-of-charge estimate in
ragtech-<upsname>.soc under the NUT state path (NUT_STATEPATH, often
/run/nut or /var/state/ups), as one line with the estimate and a
timestamp. It is rewritten every soc_save_interval seconds (1440 small
writes a day at the default 60 s), on each mains/battery transition and on
driver exit, and read back when the driver starts. A saved value older than
one hour is ignored, and so is a missing file: the driver then starts from
the firmware charge reading, which is only trustworthy as "full" while on
mains.
Things to consider for the location of the state path:
-
On a
tmpfs(the default on many systems) the writes cost no storage wear, but the estimate is lost on reboot; after a reboot during or soon after an outage the driver starts from the inflated firmware reading and re-converges as it recharges. -
On persistent storage the estimate also survives a quick reboot, but every save is a write to the medium. On systems with soldered-on flash or other wear-sensitive storage, consider a longer soc_save_interval or a
tmpfsstate path. Should the file system be slow or unavailable, the write may also delay a driver poll; a failing save is logged once. -
With soc_save_interval set to 0 nothing is written; the estimate then restarts from the firmware reading whenever the driver restarts (for example after a configuration change or a USB re-enumeration).
FAMILY 14 (EASY WAY)
The Easy Way units transmit a 32-byte frame about every 1.3 seconds on
their own, at 2560 baud 8N1, without being asked. The driver only
reads: it never writes anything to a family 14 unit, it registers no
instant commands, and upsdrv_shutdown fails (so the FSD handling of
upsmon cannot power such a UPS off through this driver). If
allow_shutdown is set it is ignored with a warning. No write command
is known for this family: the OEM device table lists no actions for it
and none was seen in captures of the OEM software.
Unlike family 10, these units do use the line speed, so the port must be
at 2560 baud (not the usual 2400: that is the first speed listed for this
family in the OEM device table, and the OEM software uses it); the driver
sets that itself. Read at 2400 the stream is corrupted in a systematic
way: bit 7 of the bytes arrives set and bit 6 is unreliable, so most
frames fail the checksum, and a few corrupted ones still pass it. A
speed like 2560 has no standard constant, so the driver asks the system
for it directly (the termios2 interface on Linux, the numeric speed on
BSD and macOS). If that fails, for instance on a platform without such
support, the driver logs a warning ("could not set 2560 baud; falling
back to 2400, expect corrupted frames") and uses 2400; the checks below
then drop most frames and the data will often be marked stale.
The 8-bit sum of the frame is a weak check (two bytes that both gain bit 7 add up to zero), so a frame is only accepted if it also passes these:
-
Registers 0x00 to 0x09 (version, model and calibration constants) are fixed in the unit. They must equal a reference, which is taken from two consecutive checksum-valid frames having identical values there; nothing is published before that, so the start-up takes a few seconds longer. If frames keep being dropped for this reason for more than 30 seconds and two consecutive ones agree on other values, those become the new reference.
-
The tap index is at most 3, the load at most 150 %, the temperature at most 100 degrees C and the battery voltage between 6 and 18 V.
-
ups.alarmentries,OVERandLBappear, and disappear, only after two consecutive accepted frames agree.OL,OBandCHRGfollow each accepted frame, so a mains cut is reported without that delay.
Published data: ups.mfr, ups.model, ups.firmware,
ups.power.nominal, ups.temperature, ups.load, ups.status,
ups.alarm, input.voltage, input.voltage.nominal,
output.voltage, output.voltage.nominal, output.frequency,
output.frequency.nominal, battery.voltage, battery.voltage.nominal
and battery.charge. There is no output current. ups.load is the
load ratio reported by the firmware. ups.power.nominal is the number
in the model name, with the same convention as for family 10;
ups.realpower.nominal is not published because the OEM table does not
say whether that number is VA or watts. battery.charge is an estimate
computed from the battery voltage, as in the OEM software, but that
voltage wobbles from frame to frame, and the NUT core reads every change
of battery.charge below 100 as charging or discharging. So the driver
publishes 100 flat while on mains with the battery-full flag set, and
otherwise a short exponential average of the estimate (about 5 s) that
never falls while CHRG is shown and never rises while on battery.
battery.voltage is the instant value. On battery the driver also sets
DISCHRG.
What was observed on hardware (mains cut and restored on one TI unit):
OL and OB follow the firmware’s on-battery flag, and the voltages,
frequency, load, battery voltage and temperature match the values shown
by the OEM software. What is inferred from bit names in the OEM table
and was not observed: CHRG (shown while on mains and the
battery-full flag is clear), LB, OVER, and every ups.alarm entry.
BOOST, TRIM and the beeper are not reported. The M1 and M2
variants follow the OEM table, but the output voltage formula of the M2
(220 V) models in that table is the 115 V one with different tap factors,
which looks doubtful, so treat output.voltage on those with suspicion
until someone confirms it.
If no accepted frame arrives for more than five seconds the data is marked stale.
CAVEATS
The serial control lines DTR and RTS are forced low by the driver immediately after opening the port. Non-zero levels on either line are interpreted by the UPS as a remote shutdown signal — never run this driver alongside other software that toggles those lines on the same device node.
On family 10, replies are framed by a 0xAA start byte and have no
checksum; the driver re-synchronizes by scanning for the start byte
after any short read. On family 14 the frames start with 55 55 AE and
end with an 8-bit sum; the driver checks every frame whose sum is right
against the constants and ranges described above, and keeps the newest
one that passes.
AUTHOR
juslex
SEE ALSO
Internet resources:
-
The NUT (Network UPS Tools) home page: https://www.networkupstools.org/
-
Reverse-engineering reference: https://github.com/antunesls/UPS_ESP32_tinySrv