Skip to content
pathum1Public

About

Monitor a ProLink USB UPS on Linux: NUT setup + GNOME top-panel indicator (battery, load, voltages, mains/battery)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

ProBlink

Monitor a ProLink USB UPS on Linux, with a GNOME top-panel indicator.

ProBlink sets up Network UPS Tools (NUT) for ProLink UPSes and adds a small GNOME Shell extension that shows:

  • battery charge
  • load
  • input / output voltage
  • a plug icon on mains power and a battery icon on battery power (the battery icon blinks while the power is off)
  • amber below 50 % charge and red below 25 % (both levels and colours can be changed)
  • a dropdown with a charge bar and all values, and notifications when power goes off, comes back, or the battery runs low
  • a settings window (click the indicator, then Settings)
 [plug]  100%  L 14%  226V          ← top panel, on mains
 [batt]   87%  L 15%  230V          ← on battery (icon blinks)
 [batt]   42%  L 15%  230V          ← below the warning level (amber)

NUT also shuts the PC down cleanly when the UPS battery runs low.

Tested only on the ProLink PRO2000SFCU (2 kVA) from the SFCU series, on CachyOS with GNOME Shell 51 and NUT 2.8.5. Other models and distributions have not been tested yet.

Quick setup

  1. Connect the UPS to the PC with its USB cable. Use a port on the back of the PC.
  2. Check that Linux sees it: run lsusb and look for 0665:5161.
  3. Download ProBlink and run the installer as your normal user:
    git clone https://github.com/pathum1/ProBlink.git
    cd ProBlink
    ./install.sh
    
  4. Enter your sudo password when it asks.
  5. Log out and log back in. The UPS indicator appears in the top panel.

The sections below explain each step in more detail.

Supported hardware

Model Status
ProLink PRO2000SFCU (2 kVA, SFCU series) Tested
Other ProLink models that show 0665:5161 in lsusb Not tested. Should work (same chip and driver)

Check your UPS: plug in its USB cable and run lsusb. You should see a line like:

ID 0665:5161 Cypress Semiconductor USB to Serial

If you see that, ProBlink will probably work for you. Other UPS brands with the same ID (many Voltronic-based units) often work too. If you try another model, please open an issue and say whether it worked.

The extension itself works with any UPS that NUT supports. Only the nut/ups.conf file is ProLink-specific.

Requirements

  • Linux with systemd
  • GNOME Shell 46 to 51 (for the extension)
  • Arch / CachyOS / Manjaro, Debian / Ubuntu, Fedora, or openSUSE (the installer uses pacman, apt-get, dnf or zypper to install NUT)

Install (details)

  1. Plug the UPS USB cable into a port on the back of the PC. (Front-panel ports and hubs can drop the connection. See Troubleshooting.)
  2. Download ProBlink:
    git clone https://github.com/pathum1/ProBlink.git
    cd ProBlink
    
  3. See what the installer will do, without changing anything:
    ./install.sh --dry-run
    
  4. Run the installer as your normal user (it asks for your sudo password):
    ./install.sh
    
  5. Log out and log back in. The indicator appears in the top panel.

The installer:

  • installs NUT if it is missing
  • writes ups.conf, nut.conf, upsd.conf, upsd.users, upsmon.conf (existing files are backed up as *.problink-backup-<date>)
  • creates a random password for upsmon
  • enables NUT so it starts at every boot, and starts it now
  • installs a small watchdog that resets the UPS on USB and restarts the NUT driver if the connection freezes (see "The panel shows a grey warning icon" below)
  • copies the extension to ~/.local/share/gnome-shell/extensions/ and enables it

Options:

Option What it does
--dry-run Show every step, change nothing
--nut-only Only set up NUT (for servers or other desktops)
--extension-only Only install the GNOME extension
--watchdog-only Only install the driver watchdog (keeps your NUT config)
--yes Do not ask before replacing NUT config files

Check that it works

  1. Read the UPS from the command line:
    upsc ups1
    
    Look for ups.status: OL (mains) and battery.charge.
  2. Read it the same way the extension does:
    gjs -m tools/check-ups.js
    

Troubleshooting

The UPS is not in lsusb, or it appears and disappears.

  1. Run journalctl -k -n 30 | grep -i usb.
  2. If you see error -71 or device not accepting address, the port or cable is bad. Move the cable to a port on the back of the PC, or try another cable.

The panel shows a grey warning icon.

  1. Run upsc ups1.
  2. If it says Data stale or Driver not connected, the driver lost the UPS. On the PRO2000SFCU the UPS's USB chip sometimes stops answering after a while, even with a good cable. The ProBlink watchdog checks every minute, resets the UPS on USB (like unplugging and replugging the cable) and restarts the driver, so it should come back by itself within about a minute. See what the watchdog did with:
    journalctl -u problink-watchdog
    
    To do the same by hand:
    sudo systemctl stop nut-driver@ups1
    sudo usbreset 0665:5161
    sudo systemctl start nut-driver@ups1
    
  3. If it says Connection refused, upsd is not running. Run:
    sudo systemctl enable --now nut.target
    

ProLink ViewPower is installed.

ViewPower and NUT both want the same USB device. Use one of them.

On new kernels (tested on 7.2), ViewPower's bundled Java 17.0.4 crashes at start with NullPointerException ... "anyController" is null, because /proc/cgroups is empty. If you want to keep ViewPower instead of NUT, add this line to /opt/ViewPower/upsMonitor.vmoptions:

-XX:-UseContainerSupport

To turn ViewPower off and use NUT:

sudo systemctl disable --now upsMonitor.service

The extension does not appear after logging back in.

  1. Run gnome-extensions info problink@pathum1.github.com.
  2. If State is ERROR, run journalctl --user -b | grep -i problink and open an issue with the output.

Change the settings

Click the indicator in the top panel, then click Settings. You can also open the settings with gnome-extensions prefs problink@pathum1.github.com.

Page Settings
Display Panel position (left, centre, right); which values appear in the panel (charge, load, voltage, runtime); how often to update, on mains and on battery
Alerts Warning and critical charge levels, and their colours; when the icon blinks (never, while on battery, or only when critical); notifications on or off
Connection upsd host, port and UPS name (to watch a UPS on another machine), a Test button, and Reset all settings

The update interval only controls how often the panel asks NUT. NUT itself reads the UPS every pollinterval seconds (set in ups.conf; ProBlink uses 5), so updating the panel faster than that shows nothing new.

Uninstall

gnome-extensions disable problink@pathum1.github.com
rm -r ~/.local/share/gnome-shell/extensions/problink@pathum1.github.com
sudo systemctl disable --now problink-watchdog.timer nut.target nut-driver@ups1
sudo rm /etc/systemd/system/problink-watchdog.{service,timer} /usr/local/sbin/problink-watchdog

Your old NUT config files are kept next to the new ones as /etc/nut/*.problink-backup-<date>.

How it works

See docs/how-it-works.md: the chain from the UPS over USB, through the nutdrv_qx driver and upsd, to the panel, plus what was found by inspecting the driver binary.

Repository layout

install.sh                         installer
nut/                               NUT config for ProLink UPSes + driver watchdog
gnome-extension/problink@…/        the GNOME Shell extension
  nut.js                             upsd protocol client (no GNOME Shell code)
  extension.js                       the panel indicator
  prefs.js                           the settings window
  schemas/                           settings and their defaults
  icons/                             the mains (plug) icon
tools/check-ups.js                 command-line test using the same client
docs/how-it-works.md               protocol notes

License

GPL-2.0-or-later. See LICENSE.

ProBlink is not made by or affiliated with ProLink. NUT is a separate project under its own license; ProBlink only configures it.

About

Monitor a ProLink USB UPS on Linux: NUT setup + GNOME top-panel indicator (battery, load, voltages, mains/battery)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages