Help with UPS Setup

dontplexonme

Dabbler
Joined
May 13, 2022
Messages
10
Hello,
I'm new to Truenas Scale (went from running a Ubuntu Docker Server to TrueNAS) and so far I'm liking it.

Just trying to finalize my Switch over to TrueNAS and finishing up with my UPS.
I have a CyberPower LE1000DG-FC from Best Buy and had it working fine on the Ubuntu Server running the Powerpanel Drivers and Configuration.
However, on TrueNAS Scale I can't seem to get any response from the UPS.

I run the command upsc ups and get Connection Refused.
I've used the powerpanel driver, genericups and usbhid-ups for the driver and still, Connection Refused on everyone.
The Port/Hostname is set to AUTO.

Just wondering if someone could help me out,
and if you need any more information just let me know!

Thanks!
 
Joined
Jun 2, 2019
Messages
591
@dontplexonme

Not sure I can be of much help with your specific UPS model, but here it goes.

1. Per the manufacturer site, the USB communication port is HID compatible.


Screen Shot 2022-05-16 at 7.07.32 PM.png


2. TrueNAS uses NUT https://networkupstools.org. It appears from the HW compatibility list, that all of the USB connected CyberPower models use the USBHID-UPS driver.


Screen Shot 2022-05-16 at 7.04.23 PM.png


3. Auto might work depending on how the UPS is presented when connected to a USB port. You might try the following command to determine the bus and device enumeration so you can force the Port/Hostname. Keep in mind that if you add/remove USB devices or reboot the system, the bus and device enumeration may change.

Code:
dmesg | grep -i usb


4. On SCALE there is a known permission issue that you have to manually change via the SSH CLI. I don't believe it persists on reboot.

Code:
chown nut /etc/nut/*
/etc/init.d/nut-server restart
upsc ups



5. If all else fails, you might be able to connect the UPS to another client, install NUT, share as a UPS Master, then configure TrueNAS as a UPS Slave. I have my APC UPS connected to my pfSense firewall as a UPS Master and all TrueNAS appliances as UPS Slave.
 
Last edited:

dontplexonme

Dabbler
Joined
May 13, 2022
Messages
10
Awesome, So far with auto, it did not work.
So im going to try to find the Proper USB port.

I run the:
dmesg | grep -i usb
command, and get this result:
[ 5.033133] usb: port power management may be unreliable
[ 5.225512] usb 1-2: new full-speed USB device number 2 using xhci_hcd
[ 5.387436] usb 1-2: New USB device found, idVendor=0764, idProduct=0501, bcdDevice= 2.00
[ 5.399314] usb 1-2: New USB device strings: Mfr=3, Product=1, SerialNumber=2
[ 5.410121] usb 1-2: Product: LE1000DG
[ 5.417507] usb 1-2: Manufacturer: CPS
[ 5.421938] usb 1-2: SerialNumber: QA6KX2000521
[ 5.553465] usb 1-14: new full-speed USB device number 3 using xhci_hcd
[ 5.714358] usb 1-14: New USB device found, idVendor=8087, idProduct=0aaa, bcdDevice= 0.02
[ 5.726277] usb 1-14: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 5.982504] usbcore: registered new interface driver usbhid
[ 5.993536] usbhid: USB HID core driver
[ 6.041454] hid-generic 0003:0764:0501.0001: hiddev0,hidraw0: USB HID v1.10 Device [CPS LE1000DG] on usb-0000:00:14.0-2/input0
[ 10.593688] usbcore: registered new interface driver btusb

Not sure what one is the proper USB port that i'd put into the Port/Address box, but ill play around with it tomorrow to see if I can get it to work properly and report back.

Thanks for your help!
 
Joined
Jun 2, 2019
Messages
591
@dontplexonme

Provide a screen cap or list of devices that show up in pull down, but it's likely /dev/uhid
 

dontplexonme

Dabbler
Joined
May 13, 2022
Messages
10
Well. After trying the permissions command you provided above, I now get a result from upsc ups

upsc ups
Init SSL without certificate database
battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 20
battery.mfr.date: CPS
battery.runtime: 2250
battery.runtime.low: 300
battery.type: PbAcid
battery.voltage: 13.8
battery.voltage.nominal: 12
device.mfr: CPS
device.model: LE1000DG
device.serial: QA6KX2000521
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: /dev/uhid
driver.parameter.synchronous: no
driver.version: 2.7.4
driver.version.data: CyberPower HID 0.4
driver.version.internal: 0.41
input.voltage: 119.0
input.voltage.nominal: 120
output.voltage: 136.0
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.delay.start: 30
ups.load: 25
ups.mfr: CPS
ups.model: LE1000DG
ups.productid: 0501
ups.realpower.nominal: 530
ups.serial: QA6KX2000521
ups.status: OL
ups.test.result: No test initiated
ups.timer.shutdown: -60
ups.timer.start: -60
ups.vendorid: 0764

Guessing that fixed it, Thanks for your help. Do you know if this permissions issue planning to be fixed soon? or fixed in a Nightly?
Much Appreciated!
 
Joined
Jun 2, 2019
Messages
591
Well. After trying the permissions command you provided above, I now get a result from upsc ups



Guessing that fixed it, Thanks for your help. Do you know if this permissions issue planning to be fixed soon? or fixed in a Nightly?
Much Appreciated!
There is already a bug report. Target release SCALE-21.06-BETA.1. It might already be in the nightlies.


You could alway create a script with the necessary commands and add it to the System Settings, Advanced, Init/Shutdown Scripts.
Just put the script somewhere on your data pool and add execute permissions (chmod a+x {filename})

Code:
#!/bin/sh

chown nut /etc/nut/*
sleep 1
/etc/init.d/nut-server restart
 
Last edited:
Joined
Jun 2, 2019
Messages
591

unixland

Dabbler
Joined
May 16, 2022
Messages
16
Does that persist on reboot?

Code:
usermod -a -G ladvd nut
/etc/init.d/nut-server restart
I think it does, but of course you can do it in the gui aswell, just add the user nut to the ladvd group, and then it surely is persisting upon boot.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
User operations won't persist beyond a reboot from the CLI, so do it in the GUI if you want to save the annoyance.
 

unixland

Dabbler
Joined
May 16, 2022
Messages
16
User operations won't persist beyond a reboot from the CLI, so do it in the GUI if you want to save the annoyance.
I have seen that *some* operations on the cli did persist through reboots. Not sure if this was one of them. However, I do agree it is always better to use the gui when possible.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
I have seen that *some* operations on the cli did persist through reboots.
Those are likely to be zfs or zpool commands... those act directly on the pool and don't mess with anything that gets overwritten by the config DB. (and other obvious things like mv, rm, cp, rsync and the likes of those which act directly on data in the pool(s)).

Anything that touches users/groups, cron tasks, network or other config like loader and sysctl variables will get nailed.
 
Top