[Plugin] NUT v2 - Network UPS Tools


dmacias

Recommended Posts

I've got a specific use case I'm hoping someone can help me solve.

 

I want my unRAID server and a NUT client to automatically power on when AC power is restored to my UPS but I can't have Nut turn my UPS off when unRAID and my client shutdown because I have a USB device that needs to remain powered for as long as I can manage otherwise it needs manual intervention.

 

Is there a way to accomplish what I'm asking for?

Link to comment
  • 3 weeks later...

Hello,
recently the following error messages appear more often in the syslog.

 

usbhid-ups[3717]: nut_libusb_get_string: Pipe error.

 

The UPS (Cyberpower CP900EPFCLCD) still works without problems.

Unfortunately I can't find anything on google about this issue.

Anyone have an idea what this is all about?

Link to comment
  • 2 weeks later...

Edit: 2022-05-09

 

I found the issue, running upsmon gave the following

 

Network UPS Tools upsmon 2.7.4.1
fopen /var/run/nut/upsmon.pid: No such file or directory
Unable to use old-style MONITOR line without a username
Convert it and add a username to upsd.users - see the documentation
Fatal error: unusable configuration

 

which isn't particularly helpful.

 

I changed the password to one without any special characters just [A-Za-z0-9] and the plugin works as expected.

 

Leaving this here in case anyone else stumbled across this as the logging for NUT and its tools wasn't helpful when the issue was simply an incorrect password.

 

Hey, having trouble getting the plugin to connect to my UPS and I've no idea what's wrong.

 

The UPS is a CP1500EPFCLCD (https://networkupstools.org/ddl/Cyber_Power_Systems/CP1500EPFCLCD.html)

 

These are the settings:

vivaldi_2AH9fg1LXk.thumb.png.ed9518bf395763188f0c820650feff40.png

 

/var/log/syslog shows

 

May  9 00:08:03 plex-server ool www[14337]: /usr/local/emhttp/plugins/nut/scripts/start
May  9 00:08:05 plex-server usbhid-ups[15659]: Startup successful
May  9 00:08:06 plex-server upsd[15666]: listening on 0.0.0.0 port 3493
May  9 00:08:06 plex-server upsd[15666]: Connected to UPS [ups]: usbhid-ups-ups
May  9 00:08:06 plex-server upsd[15667]: Startup successful

 

but the plugin just shows Status: Stopped

 

vivaldi_feIBJKa0rZ.thumb.png.ed04638af2bf02a791194ec2a28a1c18.png

 

Can anyone help?

 

Fairly certain it's working correctly, running:

 

upsc ups@localhost:3493

 

battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 20
battery.mfr.date: CPS
battery.runtime: 4890
battery.runtime.low: 300
battery.type: PbAcid
battery.voltage: 24.0
battery.voltage.nominal: 24
device.mfr: CPS
device.model: CP1500EPFCLCD
device.serial: CRXLW2000017
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.synchronous: no
driver.version: 2.7.4.1
driver.version.data: CyberPower HID 0.5
driver.version.internal: 0.55
driver.version.usb: libusb-1.0.23 (API: 0x1000107)
input.transfer.high: 260
input.transfer.low: 170
input.voltage: 239.0
input.voltage.nominal: 230
output.voltage: 260.0
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.delay.start: 30
ups.load: 9
ups.mfr: CPS
ups.model: CP1500EPFCLCD
ups.productid: 0501
ups.realpower.nominal: 900
ups.serial: CRXLW2000017
ups.status: OL
ups.test.result: No test initiated
ups.timer.shutdown: -60
ups.timer.start: -60
ups.vendorid: 0764

 

and I can configure collectd and get metrics:

 

<Plugin nut>
   UPS "ups@localhost:3493"
</Plugin>

 

Edited by dmot7291
Link to comment
  • 3 weeks later...

Does anybody have this working as a NUT server?

 

I have the plugin working and it is showing the UPS stats, it also gives me the Slave username and password, but I cant get WinNUT Client to connect at all.

image.png.fe261b7191a999cc18d603a4d48ec906.png

UPS type is set to NetServer

image.png.b41b377d9619f11e1d5a46fc77916684.png

NMAP shows the port (3493) is open and the service is nut

image.png.040bd99588d0ef974a62e16a1bd322c0.png

The WINNut Client is configured to use the Unraid Server IP and the port 3493

I've allowed the Client throgh the windows firewall (i've even tried disabling it)

I've tried all the user/password combinations but it doesn't connect at all.

 

Any suggestions?

image.png

image.png

Edited by sailingbikeruk
duplicated images
Link to comment
8 hours ago, sailingbikeruk said:

Does anybody have this working as a NUT server?

 

I have the plugin working and it is showing the UPS stats, it also gives me the Slave username and password, but I cant get WinNUT Client to connect at all.

image.png.fe261b7191a999cc18d603a4d48ec906.png

UPS type is set to NetServer

image.png.b41b377d9619f11e1d5a46fc77916684.png

NMAP shows the port (3493) is open and the service is nut

image.png.040bd99588d0ef974a62e16a1bd322c0.png

The WINNut Client is configured to use the Unraid Server IP and the port 3493

I've allowed the Client throgh the windows firewall (i've even tried disabling it)

I've tried all the user/password combinations but it doesn't connect at all.

 

Any suggestions?

image.png

image.png

 

There are different version "WinNUT"

https://networkupstools.org/projects.html#_a_href_http_sourceforge_net_projects_winnutclient_windows_nut_client_a

 

I share the UPS ( netserver ) to HA, Unraid, NAS fine, if possible, try to setup a trial Unraid as client to verify may be an easy way.

Link to comment
5 hours ago, Vr2Io said:

 

There are different version "WinNUT"

https://networkupstools.org/projects.html#_a_href_http_sourceforge_net_projects_winnutclient_windows_nut_client_a

 

I share the UPS ( netserver ) to HA, Unraid, NAS fine, if possible, try to setup a trial Unraid as client to verify may be an easy way.

 

I have V2 from https://github.com/gawindx/WinNUT-Client

 

Are you using NUT on Unraid as the Server or is that a client with the NUT Server somewhere else? I'll try as you suggest and see if I an get it to work

Link to comment
3 hours ago, Vr2Io said:

Of course, another Unraid as client and access by different client for longtime.

Ok... I'll dig out an old laptop and make a new USB and see if I can get the two to talk to each other.

 

EDIT: I've done this and it connected straight away so the issue must be with the windows client or connectivity. Thanks for the suggestion, i'll do some more trouble shooting on windows.

 

EDIT: This is now working... I am embarassed to tell you what the issue was as it is so damn stupid, but for others, just in case, I had not set a polling interval, the default in settings is 0.

 

Thanks for everyones help

Edited by sailingbikeruk
Link to comment
  • 2 weeks later...

Is there any way to send the NUT data out through mqtt? I'm trying to add the UPS energy data to homeassistant.

 

I've tried the NUT intergration in homeassistant, but here's all I get:

Battery Charge 100 %

Input Voltage 239.0 V

Load 11 %

Status Online

 

How should I acquire the energy data?

Edited by johnmick
Link to comment
  • 2 weeks later...

I have been using NUT plugin since it launched (slave, master was my Syno server), it was running very fine until recently I upgraded my unraid rig, it gives me an immediate auto 90 sec shutdown after powering up, shutdown load was set at 20% and my load was still 100%/30+ mins, any thoughts?

 

Thanks for reading.

 

05/July

Little update, i solved the problem by resetting the UPS breaker (arent so sure if it was caused by the breaker but just work.)

Edited by a24425311
Link to comment
  • 3 weeks later...

I have problem with ups Power off. I want my unraid to power off itself immediately when main power fails. that is why i set it to 

Shutdown Mode:             Battery Level

Battery Runtime Left:     Battery Runtime

Battery level to initiate shutdown (%):    96

UPS Mode:                                 Standalone

Turn off UPS after shutdown:     NO

 

Unraid start shutdown 30sec after power failure but it also turns OFF UPS. this leads to parity check and to powering off all my network switches and stuff. It also leaves my UPS in strange state that even after returning main power needs me to push the powerbutton on UPS to start working. 

 

This is not happening when my UPS runs ouf of battery.  After power returns it just turns on.

My ups is PowerWalker VI 850 LCD

 

 

Can you help me to solve this problem?

Link to comment

I´m pretty sure i read something about to short % or time can cause problems.

And also that it can work for a while but then when batteries wear down starts to cause problems.

But i´m not 100% sure about this, i can have it mixed up with something else and it was a few years ago.

 

And i think i did have some problem with using a high % on my last ups many years ago, that i solved by using time instead.

Since then i have used shut down after 3min and it has worked fine chosed 3min because when power come back here it almost always shuts of again after 10-20sec and come back after 5sec 3-4 times before it stabilize.

 

So try a lower % or try time instead and maybe not to low of a time.

And remember when trying this do not have unraid power in the ups (only USB cable).

Connect the power to a regular outlet so IF the ups cuts power to early you won´t get a unclean shutdown and a parity check.

As long as you connect the USB cable unraid and ups will talk to each other normally and will initiate a shutdown when you yank the cable or use a on/off switch, so just look/listening for when unraid shut off and see if ups turn of before that or not.

Link to comment

I have something exotic here it seems

I recently acquired a Vertiv Liebert GXT5-1500 for my Servercloset, and i am happy with it sofar.

However i cant seem to get it to work with NUT at all. It wont find it with the USBHID driver, always complains about no device being found.

I tried to set various ports and tried various drivers with no result.

 

Interestingly, in a way, the GXT5s USB Port acts as both a HID and CDC device. THe Unit reports both a ttyACM0 aswell as a hid-generic device.

Maybe i am doing something wrong aswell, but i am not awawre what it could be.

Link to comment
  • 2 weeks later...
On 7/25/2022 at 12:09 PM, pyrlix said:

I have something exotic here it seems

I recently acquired a Vertiv Liebert GXT5-1500 for my Servercloset, and i am happy with it sofar.

However i cant seem to get it to work with NUT at all. It wont find it with the USBHID driver, always complains about no device being found.

I tried to set various ports and tried various drivers with no result.

 

Interestingly, in a way, the GXT5s USB Port acts as both a HID and CDC device. THe Unit reports both a ttyACM0 aswell as a hid-generic device.

Maybe i am doing something wrong aswell, but i am not awawre what it could be.

Ironically, I just grabbed the exact same thing and having the same issue.  Any luck?

Link to comment

hi

 

Recently I noted a bit of a strange behavior with the consuming display in the status bar. If the UPS load is below a certain % of usage, it shows the (calculated) wattages. But when it's getting over this value, it only shows 1w for the current consumption.  The dashboard it self show always the (calculated) wattages.

ups-statusbar-low.png

 

ups-status-low.png

 

ups-statusbar.png

 

ups-status.png

 

Unraid Version: 6.10.3

UPS: PowerWalker VI 1200 SHL (1200VA/600W)

ups-details.png

Link to comment
On 2/15/2022 at 1:53 AM, s1oz said:

Lost UPS after running for a while, NUT plugin shows running, but no UPS device shows
After re-plugging and unplugging the USB, restart the NUT plugin and enable it normally

Feb 1 11:03:10 Tower upsmon[14759]: Poll UPS [[email protected]] failed - Data stale
Feb 1 11:03:11 Tower usbhid-ups[13944]: device->Product is NULL so it is not possible to determine whether to activate max_report_size workaround
Feb 1 11:03:13 Tower usbhid-ups[13944]: device->Product is NULL so it is not possible to determine whether to activate max_report_size workaround
Feb 1 11:03:15 Tower usbhid-ups[13944]: device->Product is NULL so it is not possible to determine whether to activate max_report_size workaround
Feb 1 11:03:15 Tower upsmon[14759]: Poll UPS [[email protected]] failed - Data stale
Feb 1 11:03:17 Tower usbhid-ups[13944]: device->Product is NULL so it is not possible to determine whether to activate max_report_size workaround
Feb 1 11:03:19 Tower usbhid-ups[13944]: device->Product is NULL so it is not possible to determine whether to activate max_report_size workaround

 

 

I'm getting the same error message every few days. It doesn't seem to correlate to a particular time or event. Unraid's built-in UPS tool never had these dropouts, but I switched to NUT because APCUPSD interpreted the fully-charged state of my UPS as a power failure (my UPS was reporting "Online + On Battery"). I have an APC BGM1500B.

 

When I unplug and replug the UPS into the server, it works again after restarting NUT. Restarting NUT, or disabling and reenabling without unplugging the USB cable does not fix the problem.

Link to comment

 

Hey everyone,

 

Ive been doing my head in trying to get a ups to play nice with nut, but it seems ive hit a wall and cant sort it out myself.

 

At the moment i can detect it and connect, but get no information from it and the server is unaware when the ups switches to battery mode.

 

I am fairly certain i need to use subdriver and/or protocol hunnox to get my device to work. it looks like @IGHOR may have had the answer in the form of a modified .txz file to help out @Jammy B but that link is no longer available. Info below to ID my unit, its a Digitech MP-5205 650VA but seems to be a clone of powercool, or maybe the other way around...

 

 

Scanning for UPS...

[nutdev1]
driver = "nutdrv_qx"
port = "auto"
vendorid = "0001"
productid = "0000"
product = "MEC0003"
bus = "002"

 

 

 

 

/etc/nut/ups.conf

[ups]
driver = nutdrv_qx
port = auto
subdriver = hunnox
vendorid = 0001
productid = 0000
langid_fix = 0x0409
novendor

ondelay = 180
offdelay = 60
default.battery.voltage.high = 13
default.battery.voltage.low = 11
default.battery.voltage.nominal = 12.7
override.battery.packs = 6
runtimecal = 480,100,1200,50
chargetime = 28800
 

 

root@Tower:~# upsdrvctl start
Network UPS Tools - UPS driver controller 2.7.4.1
Network UPS Tools - Generic Q* USB/Serial driver 0.39 (2.7.4.1)
USB communication driver 0.43
Subdriver 'hunnox' not found!
Driver failed to start (exit status=1)

 

 

If i remove the subdriver line from ups.conf i can get this

 

root@Tower:~# upsc [email protected]
battery.charge: 1
battery.packs: 6
battery.runtime: 37
battery.voltage: 0.00
battery.voltage.high: 13
battery.voltage.low: 11
battery.voltage.nominal: 12.7
device.type: ups
driver.name: nutdrv_qx
driver.parameter.chargetime: 28800
driver.parameter.offdelay: 60
driver.parameter.ondelay: 180
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.productid: 0000
driver.parameter.runtimecal: 480,100,1200,50
driver.parameter.synchronous: no
driver.parameter.vendorid: 0001
driver.version: 2.7.4.1
driver.version.data: Q1 0.07
driver.version.internal: 0.39
driver.version.usb: libusb-1.0.24 (API: 0x1000107)
input.frequency: 0.0
input.voltage: 0.0
input.voltage.fault: 0.0
output.voltage: 0.0
ups.beeper.status: disabled
ups.delay.shutdown: 60
ups.delay.start: 180
ups.load: 0
ups.productid: 0000
ups.status: OL
ups.temperature: 0.0
ups.type: online
ups.vendorid: 0001

 

 

I tried compiling from git in ubuntu but its a bit out of my league for the moment.

 

Cheers

Edited by k1netic
spelling
Link to comment
On 8/18/2022 at 7:50 PM, Batman said:

 

I'm getting the same error message every few days. It doesn't seem to correlate to a particular time or event. Unraid's built-in UPS tool never had these dropouts, but I switched to NUT because APCUPSD interpreted the fully-charged state of my UPS as a power failure (my UPS was reporting "Online + On Battery"). I have an APC BGM1500B.

 

When I unplug and replug the UPS into the server, it works again after restarting NUT. Restarting NUT, or disabling and reenabling without unplugging the USB cable does not fix the problem.

 

It would be nice to actually solve the issue, but I wrote a short script that resets the USB when the connection is lost. It's scheduled to run on a regular basis with the User Scripts plugin.

#!/bin/bash
# Test communication with UPS
if upscmd -l ups > /dev/nul; then
    echo The UPS is connected.
else
    echo Error: Communication with the UPS has failed!
    if usbreset "Back-UPS BGM1500  FW:000000G0-313200S9"; then
        echo USB reset completed successfully.
    else
        echo Error: USB reset failed!
    fi
fi

 

Edit: usbreset now shows a slightly different name for my UPS, so the script above stopped working. I couldn't figure out if or how usbreset would use wildcards, so this modified script works:

 

#!/bin/bash
# Test communication with UPS
if upscmd -l ups > /dev/nul; then
    echo The UPS is connected.
else
    echo Error: Communication with the UPS has failed!
    # Get USB path for the UPS
    APC=$( lsusb | grep "American Power Conversion" | perl -nE "/\D+(\d+)\D+(\d+).+/; print qq(\$1/\$2)")
    # Test for a USB conection
    if [ -z "$APC" ]; then
        echo Error: No USB UPS detected!
    else
        echo Resetting the USB connection...
        # Reset the USB connection
        if usbreset $APC; then
            echo USB reset completed successfully.
        else
            echo Error: USB reset failed!
        fi
    fi
fi

 

Edited by Batman
  • Like 1
Link to comment
19 hours ago, k1netic said:

 

Hey everyone,

 

Ive been doing my head in trying to get a ups to play nice with nut, but it seems ive hit a wall and cant sort it out myself.

 

At the moment i can detect it and connect, but get no information from it and the server is unaware when the ups switches to battery mode.

 

I am fairly certain i need to use subdriver and/or protocol hunnox to get my device to work. it looks like @IGHOR may have had the answer in the form of a modified .txz file to help out @Jammy B but that link is no longer available. Info below to ID my unit, its a Digitech MP-5205 650VA but seems to be a clone of powercool, or maybe the other way around...

 

 

Scanning for UPS...

[nutdev1]
driver = "nutdrv_qx"
port = "auto"
vendorid = "0001"
productid = "0000"
product = "MEC0003"
bus = "002"

 

 

 

 

/etc/nut/ups.conf

[ups]
driver = nutdrv_qx
port = auto
subdriver = hunnox
vendorid = 0001
productid = 0000
langid_fix = 0x0409
novendor

ondelay = 180
offdelay = 60
default.battery.voltage.high = 13
default.battery.voltage.low = 11
default.battery.voltage.nominal = 12.7
override.battery.packs = 6
runtimecal = 480,100,1200,50
chargetime = 28800
 

 

root@Tower:~# upsdrvctl start
Network UPS Tools - UPS driver controller 2.7.4.1
Network UPS Tools - Generic Q* USB/Serial driver 0.39 (2.7.4.1)
USB communication driver 0.43
Subdriver 'hunnox' not found!
Driver failed to start (exit status=1)

 

 

If i remove the subdriver line from ups.conf i can get this

 

root@Tower:~# upsc [email protected]
battery.charge: 1
battery.packs: 6
battery.runtime: 37
battery.voltage: 0.00
battery.voltage.high: 13
battery.voltage.low: 11
battery.voltage.nominal: 12.7
device.type: ups
driver.name: nutdrv_qx
driver.parameter.chargetime: 28800
driver.parameter.offdelay: 60
driver.parameter.ondelay: 180
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.productid: 0000
driver.parameter.runtimecal: 480,100,1200,50
driver.parameter.synchronous: no
driver.parameter.vendorid: 0001
driver.version: 2.7.4.1
driver.version.data: Q1 0.07
driver.version.internal: 0.39
driver.version.usb: libusb-1.0.24 (API: 0x1000107)
input.frequency: 0.0
input.voltage: 0.0
input.voltage.fault: 0.0
output.voltage: 0.0
ups.beeper.status: disabled
ups.delay.shutdown: 60
ups.delay.start: 180
ups.load: 0
ups.productid: 0000
ups.status: OL
ups.temperature: 0.0
ups.type: online
ups.vendorid: 0001

 

 

I tried compiling from git in ubuntu but its a bit out of my league for the moment.

 

Cheers

 

Ok ive figured out the compiling in an Ubuntu VM and moved drivers over to a new txz like @IGHOR did, i think.

 

but i get an error when trying upsdrvctl start

 

root@Tower:~# upsdrvctl start
Network UPS Tools - UPS driver controller 2.7.4.1
/usr/libexec/nut/nutdrv_qx: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by /usr/libexec/nut/nutdrv_qx)
Driver failed to start (exit status=1)

 

any ideas ?

Link to comment
18 hours ago, k1netic said:

 

Ok ive figured out the compiling in an Ubuntu VM and moved drivers over to a new txz like @IGHOR did, i think.

 

but i get an error when trying upsdrvctl start

 

root@Tower:~# upsdrvctl start
Network UPS Tools - UPS driver controller 2.7.4.1
/usr/libexec/nut/nutdrv_qx: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by /usr/libexec/nut/nutdrv_qx)
Driver failed to start (exit status=1)

 

any ideas ?

If anyone gets to this point, GLIBC_2.34 is available in unraid 6.11.0.rc3 at time of posting

 

This allows you to use nut 2.8.0, but strangely i can now download the file posted by @IGHOR and this was a better option than running an rc3 build.

 

I now have my UPS digitech 650va communicating with NUT using the following

 

[ups]
driver = nutdrv_qx
port = auto
subdriver = hunnox
productid = 0000
vendorid = 0001
product = "MEC0003"
protocol = hunnox
langid_fix = 0x409
novendor
noscanlangid

default.battery.voltage.high = 13.7
default.battery.voltage.low = 11
default.battery.voltage.nominal = 12.7
runtimecal = 480,100,1200,50
chargetime = 28800

ondelay = 180
offdelay = 60

 

Cheers

Link to comment
  • Rysz featured this topic

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.