sysutils/nut: support multiple UPS devices#5542
Open
toreamun wants to merge 1 commit into
Open
Conversation
The model gets a list of UPS devices (name, driver, power value, arguments) instead of one enable flag per driver, shown as a grid on the settings page. A migration converts existing configurations. The status page and dashboard widget show all devices and now read the variables directly from upsd, since upsc from NUT 2.8.5 segfaults on FreeBSD 14.3 (networkupstools/nut issue 3454).
toreamun
force-pushed
the
nut-multiple-ups
branch
from
July 9, 2026 17:39
9d2c91f to
4914d49
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important notices
Before you submit a pull request, we ask you kindly to acknowledge the following:
If AI was used, please disclose:
Describe the problem
The plugin only supports a single UPS: the model has one enable flag per driver type and a single global UPS name. NUT itself handles any number of devices. Enabling more than one driver today even generates a broken ups.conf (duplicate sections with the same name), so there is no way to monitor for example two USB HID devices on the same box.
Describe the proposed solution
Replace the per-driver sections in the model with a list of UPS devices (name, driver, power value, arguments), shown as a grid on the settings page. The ups.conf and upsmon.conf templates loop over the list, SHUTDOWNCMD/POWERDOWNFLAG are emitted once, and each MONITOR line gets a configurable power value so a UPS that does not feed this system can be set to monitoring only (0). The netclient section gets its own name field instead of borrowing the global one.
A model migration (1.0.4 -> 1.1.0) converts existing configurations: the enabled driver section becomes the first row in the list, keeping name and arguments (apcupsd hostname/port become a port argument). I verified that an existing setup produces identical ups.conf/upsmon.conf after migrating.
The diagnostics page and the dashboard widget now show status per UPS. While testing this I found that upsc from NUT 2.8.5 segfaults on FreeBSD 14.3 (networkupstools/nut#3454), which left the status page and widget empty regardless of this change, so the status action now reads the variables directly from upsd instead of shelling out to upsc (same output format).
Tested on OPNsense 26.1.11 with an APC Back-UPS ES 700 and an Eaton 3S (both usbhid-ups), including migration from os-nut 1.9_1, editing and toggling devices from the grid, and upsd/upsmon picking up both devices.
Related issue
None.