There are several videos on installing Network UPS Tools (NUT) on the Raspberry Pi. The best detailed instruction I’ve seen is:
https://www.youtube.com/watch?v=vyBP7wpN72c
Note: this includes a fix for a Tripp-Lite problem
However, this does not cover some specific instances where problems arise with multiple units from one manufacturer
There are 5 files to edit in order to get minimal functionality: nut.conf, ups.conf, uspd.conf, upsmon.conf, and upsd.users. There is a sixth for the web interface: hosts.conf. Some of these files contain interlocking information so what is in one file affects the function of another. That can make troubleshooting difficult when things to sideways.
Easy configs first.
nut.conf contains a single line MODE = status. There are 4 possible entries with the default of none which is the off state. It can be standalone, netserver or netclient. Use netserver if you ever expect it feed information to another NUT installation.
upsd.conf contains a single line LISTEN IPaddress port. This is for internal communication between various elements of a NUT install. Default is 127.0.0.1 3493.
upsd.user contains a block username with password and admin status either master or client.
[username]
password = xxxxxxxx
admin master
More complex configs
ups.conf: contains the unit name, driver, port, description (optional) and unique product identification information.
The description should look like this:
[MyUPSname]
driver = usbhid-ups
port = auto
desc = “CyberPower 1500”
vendorid = 0764
productid = 0501
pollinterval = 15
For a single unit, vendorid and productid are adequate. If you have multiple units they must be distinguished by some combination of vendor, product, serial, vendorid and productid. Not all are necessary; just the ones that produce a unique identification. This can be difficult if you have multiple units from the same manufacturer as they may have the same vendorid and productid. sudo nut-scanner -UN will produce the correct configuration that can be copied into the ups.conf file.
Here is where things get complicated for multiple units on a single monitor. You cannot always get a unique combination nor does nut-scanner always produce a working configuration. One complication is nut-scanner may produce a different result or fail for a unit when it is in combination with another as opposed to stand alone. Individually, the units can connect but cannot be successfully combined. I tested 6 CyberPower units. I was able to get 4 to function as two pairs but 2 units would never work in any combination. Part of the problem is some units do not produce a usable serial number and some will cause nut-scanner to fail when in combination with another unit. Seems that using the bus and device/port numbers together would work as a unique identifier then the vendorid and productid would be supplementary information for configuration but the input for port is limited to the tty terminal for serial connections and is ignored for USB.
Following the digital trail, looks like Eaton took over the project but no longer supports it. They have what appears to be a competing product for sale so don’t expect any updates to NUT. The source code SKD and documents are available at Github https://github.com/networkupstools/nut/tree/Eaton_SDK
The video was an installation on a Raspberry Pi 4. I tried it on a Raspberry Pi 3+ Model B. NUT installed but did not include the nut-scanner command. Found some scattered information about the missing command but nothing concrete to solve the problem.
Vendorid and productid: You can get the Model and ProductID from the usb-devices command or from lsusb command. An example format for lsusb is
Bus 001 Device 012: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS
The 0764:0501 are the vendorid:productid which is adequate for a single ups connection.
You can get more detail using lsusb -s 1:12 -v or lsusb -d 0764:001 -v
If you use usb-devices, you may find the model name is not the same as found in lsusb description even though the vendorid and productid are the same.
pollinterval: After getting the correct driver, I installed the web server and successfully connected to the web page with the UPS data. However, it timed out and would display stale data warning after about 20 minutes. A quick check of the problem is to run sudo upsdrvctl start and the data refreshes. Troubleshooting information from other posts indicated that NUT and UPS were timing out at different intervals so NUT thought the UPS was offline and offered up a stale data warning. Fixing it led down several blind alleys. Turns out neither MAXAGE nor DEADTIME have any effect on this. You need to include pollinterval = 15 in the device description; it will not work outside the device description. This problem may be specific to CyberPower but may occur with others.
driver:usbhid-ups is the only driver you can use with USB connected devices. Details are at: https://networkupstools.org/docs/man/usbhid-ups.html
upsmon.conf: contains the name of the unit to be monitored with @localhost, a digit, admin password and status
MONITOR CyberPower@localhost 1 admin password master. The name comes from ups.conf file; the password comes from uspd.users. For the upsc command, just the name is adequate The digit is 0 if no UPS is powering the monitoring computer, 1 if a single UPS powers the monitoring computer. Higher numbers indicate the total UPS units powering the computer. If a computer has 4 UPS units powering it but only 2 are needed to provide adequate power, the shutdown command needs to be adjusted so it won’t trip when 1 UPS goes offline.
Web page:
Firewall: The Apache installation on the Raspberry Pi went smoothly and the firewall was automatically configured for the NUT web page. However, the Ubuntu machine had a UFW and automatic configuration did not occur. It was only necessary to open port 80 and it worked.