Skip to content

Commit

Permalink
Merge pull request #2063 from EchterAgo/apc_modbus
Browse files Browse the repository at this point in the history
  • Loading branch information
jimklimov authored Oct 20, 2023
2 parents ff24189 + df296a8 commit e6cd5b3
Show file tree
Hide file tree
Showing 9 changed files with 1,444 additions and 6 deletions.
6 changes: 6 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
# if you want to hide at the bottom, that's fine by me. Just clarify
# your preference when submitting changes to this file.

N: Axel Gembe
E: [email protected]
W: http://axel.gembe.net/
D: Added APC Modbus support
P: rsa4096/43109AAC 11E6 515C B8A4 26C6 07C1 36A4 1CB3 AA21 4310 9AAC

N: Stephen Brown
E: [email protected]
W: http://www.datalimbo.net/
Expand Down
8 changes: 8 additions & 0 deletions data/driver.list.in
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,15 @@
"APC" "ups" "3" "SMC2200BI-BR" "USB" "usbhid-ups" # https://github.com/networkupstools/nut/issues/557
"APC" "ups" "3" "Smart-UPS (USB)" "USB" "usbhid-ups"
"APC" "ups" "3" "Smart-UPS 750 (SMT750I, USB)" "USB" "usbhid-ups"
"APC" "ups" "3" "Smart-UPS 1500 (SMT1500I, USB)" "USB" "usbhid-ups"
"APC" "ups" "3" "Smart-UPS X 750 (SMX750I, USB)" "USB" "usbhid-ups"
"APC" "ups" "3" "Smart-UPS X 1500 (SMX1500I, USB)" "USB" "usbhid-ups"
"APC" "ups" "3" "SMC2200BI-BR" "USB" "apc_modbus" # https://github.com/networkupstools/nut/issues/557
"APC" "ups" "3" "Smart-UPS (USB)" "USB" "apc_modbus"
"APC" "ups" "3" "Smart-UPS 750 (SMT750I, USB)" "USB" "apc_modbus"
"APC" "ups" "3" "Smart-UPS 1500 (SMT1500I, USB)" "USB" "apc_modbus"
"APC" "ups" "3" "Smart-UPS X 750 (SMX750I, USB)" "USB" "apc_modbus"
"APC" "ups" "3" "Smart-UPS X 1500 (SMX1500I, USB)" "USB" "apc_modbus"
"APC" "ups" "3" "CS500" "USB" "usbhid-ups (limited data available)" # https://github.com/networkupstools/nut/issues/1776#issuecomment-1377784584
"APC" "ups" "1" "Back-UPS" "940-0095A/C cables" "genericups upstype=1"
"APC" "ups" "1" "Back-UPS" "940-0020B/C cables" "genericups upstype=2"
Expand Down
9 changes: 6 additions & 3 deletions docs/man/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -666,15 +666,17 @@ SRC_MODBUS_PAGES = phoenixcontact_modbus.txt \
generic_modbus.txt \
huawei-ups2000.txt \
socomec_jbus.txt \
adelsystem_cbi.txt
adelsystem_cbi.txt \
apc_modbus.txt

if ! SOME_DRIVERS
if WITH_MANS
MAN_MODBUS_PAGES = phoenixcontact_modbus.8 \
generic_modbus.8 \
huawei-ups2000.8 \
socomec_jbus.8 \
adelsystem_cbi.8
adelsystem_cbi.8 \
apc_modbus.8
endif WITH_MANS

if WITH_MODBUS
Expand All @@ -685,7 +687,8 @@ HTML_MODBUS_MANS = phoenixcontact_modbus.html \
generic_modbus.html \
huawei-ups2000.html \
socomec_jbus.html \
adelsystem_cbi.html
adelsystem_cbi.html \
apc_modbus.html
endif ! SOME_DRIVERS

# (--with-linux_i2c)
Expand Down
76 changes: 76 additions & 0 deletions docs/man/apc_modbus.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
APC_MODBUS(8)
=============

NAME
----

apc_modbus - Driver for APC Smart-UPS Modbus protocol

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

Generally this driver should work for all the APC Modbus UPS devices. Some
devices might expose more than is currently supported, like multiple phases.

Tested with the following hardware:

- SMT1500 (Smart-UPS 1500, Firmware 9.6)
- SMX750 (Smart-UPS X 750, Firmware 10.1)
- SMX1500 (Smart-UPS X 1500, Firmware 15.0)

Note that you will have to enable Modbus communication. In the front panel of
the UPS, go to Advanced Menu mode, under Configuration and enable Modbus.

EXTRA ARGUMENTS
---------------

This driver also supports the following optional settings:

include::nut_usb_addvars.txt[]

*porttype*='value'::
Set the type of the port used. Available values are serial for RS232/485 based
connections, tcp for TCP/IP connections and usb for USB connections.

*port*='value'::
Depending on the port type you can select a port here. For usb only auto is
supported, for serial you can pass a device path like /dev/ttyS0 and for tcp you
can pass a hostname with optional port like example.com:502.

*baudrate*='num'::
Set the speed of the serial connection. The default baudrate is 9600.

*parity*='value'::
Set the parity of the serial connection. Available values are N for none, E for
even and O for odd. The default parity is N (none).

*databits*='num'::
Set the data bits of the serial connection. The default databits is 8.

*stopbits*='num'::
Set the stop bits of the serial connection. The default stopbits is 1.

*slaveid*='num'::
Set the Modbus slave id. The default slave id is 1.

*response_timeout_ms*='num'::
Set the Modbus response timeout. The default timeout is set by libmodbus. It can
be good to set a higher timeout on TCP connections with high latency.

AUTHORS
-------

* Axel Gembe <[email protected]>

SEE ALSO
--------

The core driver
~~~~~~~~~~~~~~~~

linkman:nutupsdrv[8], linkman:ups.conf[5]

Internet resources
~~~~~~~~~~~~~~~~~~

The NUT (Network UPS Tools) home page: https://www.networkupstools.org/
10 changes: 9 additions & 1 deletion docs/nut.dict
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
personal_ws-1.1 en 3247 utf-8
personal_ws-1.1 en 3255 utf-8
AAC
AAS
ABI
ACFAIL
Expand Down Expand Up @@ -85,6 +86,7 @@ Autobook
Autoconfigure
Autostartup
Avocent
Axel
Axxium
BATGNn
BATNn
Expand Down Expand Up @@ -421,6 +423,7 @@ Gammons
Gandi
Gaspar
Gathman
Gembe
GenTestFail
Gert
GetUPSVars
Expand Down Expand Up @@ -1798,6 +1801,7 @@ d'un
da
daisychain
daisychained
databits
datacenter
datadir
datagrams
Expand Down Expand Up @@ -2616,6 +2620,7 @@ pollinterval
pollonly
popa
portname
porttype
powercom
powerdev
powerdown
Expand Down Expand Up @@ -2753,6 +2758,7 @@ rootfs
rootfs'es
rq
rqt
rsa
rsync
rts
runlevel
Expand Down Expand Up @@ -2834,6 +2840,7 @@ sitop
sizeof
ske
skel
slaveid
slavesync
slewrate
slibtool
Expand Down Expand Up @@ -2888,6 +2895,7 @@ stdupsv
stopAtConnect
stopAtEntry
stopIP
stopbits
str
strace
strarr
Expand Down
4 changes: 3 additions & 1 deletion drivers/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ SERIAL_USB_DRIVERLIST = \
nutdrv_qx
NEONXML_DRIVERLIST = netxml-ups
MACOSX_DRIVERLIST = macosx-ups
MODBUS_DRIVERLIST = phoenixcontact_modbus generic_modbus huawei-ups2000 socomec_jbus adelsystem_cbi
MODBUS_DRIVERLIST = phoenixcontact_modbus generic_modbus huawei-ups2000 socomec_jbus adelsystem_cbi apc_modbus
LINUX_I2C_DRIVERLIST = asem pijuice
POWERMAN_DRIVERLIST = powerman-pdu
IPMI_DRIVERLIST = nut-ipmipsu
Expand Down Expand Up @@ -294,6 +294,8 @@ generic_modbus_SOURCES = generic_modbus.c
generic_modbus_LDADD = $(LDADD_DRIVERS) $(LIBMODBUS_LIBS)
adelsystem_cbi_SOURCES = adelsystem_cbi.c
adelsystem_cbi_LDADD = $(LDADD_DRIVERS) $(LIBMODBUS_LIBS)
apc_modbus_SOURCES = apc_modbus.c $(LIBUSB_IMPL) hidparser.c usb-common.c
apc_modbus_LDADD = $(LDADD_DRIVERS) $(LIBMODBUS_LIBS) $(LIBUSB_LIBS)

# Huawei UPS2000 driver
# (this is both a Modbus and a serial driver)
Expand Down
Loading

0 comments on commit e6cd5b3

Please sign in to comment.