-
rosslaird started following Ugreen UPS with Unraid
-
Ugreen UPS with Unraid
Here's a Docker Compose setup that worked for me. It's more involved than the NUT plugin, but might be useful if you prefer Compose for managing your containers. mkdir -p /boot/config/plugins/compose.manager/projects/nut-upsd #or wherever your Compose files live Create docker-compose.yaml: services: nut-upsd: image: instantlinux/nut-upsd:latest container_name: nut-upsd restart: unless-stopped privileged: true pid: host ports: - "3493:3493" volumes: - /mnt/cache/appdata/nut-upsd:/etc/nut entrypoint: /etc/nut/start.sh Notes privileged: true is required for USB access and host shutdown pid: host allows the container to trigger a graceful host poweroff via nsenter NUT config files need Unix file permissions (e.g., 640 for passwords), so they must live on a POSIX filesystem. The UnRAID boot drive is FAT32, which doesn't support Unix permissions — so I put the config at /mnt/cache/appdata/nut-upsd/ instead of /boot/config/ Config files mkdir -p /mnt/cache/appdata/nut-upsd ups.conf: ini maxretry = 3 retrydelay = 5 [ugreenups] driver = usbhid-ups port = auto vendorid = 2b89 productid = ffff subdriver = Arduino desc = "Ugreen US3000 via USB" pollinterval = 15 user = root upsd.conf: LISTEN 0.0.0.0 3493 ALLOW_NOT_ALL_LISTENERS 1 upsd.users: [upsmon] password = YOUR_PASSWORD_HERE upsmon primary upsmon.conf: MONITOR ugreenups@localhost 1 upsmon YOUR_PASSWORD_HERE primary MINSUPPLIES 1 SHUTDOWNCMD "/bin/nsenter -t 1 -m -u -i -n -- /sbin/poweroff" POLLFREQ 5 POLLFREQALERT 5 HOSTSYNC 15 DEADTIME 15 FINALDELAY 5 RBWARNTIME 43200 NOCOMMWARNTIME 300 POWERDOWNFLAG /etc/nut/killpower nut.conf: MODE=netserver start.sh (custom entrypoint -- the default one has issues with duplicate config entries and restart loops): #!/bin/sh mkdir -p /var/run/nut chown nut:nut /var/run/nut chown root:nut /etc/nut/*.conf chmod 640 /etc/nut/*.conf /usr/sbin/upsdrvctl start /usr/sbin/upsd -F & sleep 2 exec /usr/sbin/upsmon -D Make it executable: chmod +x /mnt/cache/appdata/nut-upsd/start.sh Testing it out: cd /boot/config/plugins/compose.manager/projects/nut-upsd docker compose up -d docker exec nut-upsd upsc ugreenups@localhost You should see output like: battery.charge: 57 device.mfr: UGREEN device.model: US3000 ups.status: OL DISCHRG CHRG Further Notes upsmon inside the container monitors the UPS via upsd When battery hits the low threshold (20% by default), upsmon runs the SHUTDOWNCMD The command uses nsenter -t 1 to execute poweroff on the host (not inside the container) No need to configure anything in UnRAID's Settings > UPS page The image's default entrypoint appends duplicate LISTEN lines to upsd.conf on every restart. The custom start.sh above avoids this. user = root in ups.conf is needed so the driver can access USB devices from inside the container. Without it, the default nut user gets "insufficient permissions" on USB. Separately, you should have a firewall rule to restrict port 3493 (NUT) to only trusted networks (e.g. LAN and Tailscale), so the UPS service isn't exposed to the internet. Since USB device paths can change across reboots, I also have vendorid and productid in ups.conf with port = auto , which is more reliable than hardcoding a /dev/bus/usb/ path.
rosslaird
Members
-
Joined
-
Last visited