You should see a NEW serial port (like /dev/ttyUSB0
) been added to /dev
. Remember that for the later steps.
If not, please refer to this GitHub repo for building and installing the driver for CH341 USB to Serial Converter chips.
Edit /etc/ups/ups.conf
, replace the [ups]
section with
[ups]
driver = apcsmart
port = /dev/ttyUSB0 # The new device found in Step 1
Start apcsmart
sudo apcsmart -DDD -a ups
If it starts to print a ton of logs, the connection is good.
In some cases apcsmart
reports "unable to detect an APC Smart protocol UPS", perform the following diagnostics.
- Check your cable connection
- Check your device name, ensure it is the UPS, not other one that happens to be a serial port. If this doesn't solve the problem...
- Get anything that can talk to
/dev/ttyUSB0
at2400
baud installed on your NAS (minicom
/screen
/pyserial
, anything you like) - Assume you have
minicom
, start it withsudo minicom -D /dev/ttyUSB0 -b 2400
- Type
Y
(the capital Y, must be upper case), it should printSM
(for Smart Mode) according to the Protocol Specification. If not... - Type
Y
multiple times (at least 10), if at some point the terminal prints a lot ofSM
, the driver is faulty, build and install a new driver from Step 1, and start over. - Type
A
(the capital A, must be upper case), it should printOK
and the UPS should beep for 2 seconds. If not, the UPS might be faulty, please contact the customer service. - If none of above happens, either the device name is wrong, or the UPS is faulty, or it's not a SPM/SPRM Series UPS.
Edit /usr/syno/etc/ups/nutscan-usb.h
(or /etc/ups/nutscan-usb.h
and /etc.defaults/ups/nutscan-usb.h
if you are using DSM 7.1.1), add the following line before the /* Terminating entry */
line:
{ 0x1a86, 0x5523, "apcsmart" },
Here 1a86:5523
is the VID:PID
pair of the CH341 device.
Save the file and reboot your NAS.
After rebooting, edit /usr/syno/lib/systemd/scripts/ups-usb.sh
- Add a new variable right after the swarm of
UPS_xxx
variable definitions
UPS_PORT="/dev/ttyUSB0" # The new device found in Step 1
- There is a line near the beginning of function
SwitchConf2Usb
(mine is the first line) that looks like
/bin/sed -i "s/^\tport = .*/\tport = auto/" $UPS_CONF
Replace it with
/bin/sed -i "s|^\tport = .*|\tport = $UPS_PORT|" $UPS_CONF
NOTICE THE DELIMITER OF sed
IS DIFFERENT
- There is a line near the beginning of function
StartAllDrv
(mine is also the first line) that looks like
local DRV_LIST="usbhid-ups blazer_usb bcmxcp_usb richcomm_usb tripplite_usb"
Prepend apcsmart
to the list, turning it into:
local DRV_LIST="apcsmart usbhid-ups blazer_usb bcmxcp_usb richcomm_usb tripplite_usb"
- Start the service
sudo systemctl start ups-usb
After starting the service, you will notice that the UPS was recognized by DSM, and ready to configure.
Create a new file under directory /usr/local/etc/rc.d
with name 01-ups-apcsmart.sh
(or any other name you like) and content:
#!/bin/sh
systemctl $1 ups-usb
Then make it executable
sudo chmod +x /usr/local/etc/rc.d/01-ups-apcsmart.sh
Reboot your NAS. Now the UPS should be auto-detected by your NAS.