OPNsense Forum

English Forums => 25.1, 25.4 Production Series => Topic started by: amd.64 on February 23, 2025, 10:46:59 PM

Title: UPS Settings and options
Post by: amd.64 on February 23, 2025, 10:46:59 PM
I am running 25.1.1

I have just connected a APC Back-UPS XS 1500 LCD, I have a few of questions.

Title: Re: UPS Settings and options
Post by: OPNenthu on February 24, 2025, 04:29:56 AM
You can administer the UPS through the terminal using NUT commands such as 'upsrw' and 'upscmd', assuming you set up an admin user in NUT.  Not all UPS models allow you to change the battery install date (mine doesn't).  Short discussion about it here (https://forum.netgate.com/topic/171866/can-t-update-battery-date-in-nut).

On the OPNsense terminal you could do a few things:

$ upsrw -u admin -p <password> <ups>

... to get the list of variables that you can change on the UPS.  Replace <ups> with the name that you assigned the UPS and the server IP, e.g. "apc01@192.168.1.100".

$ upsrw -s <variable> -u admin -p <password> <ups>

... to set a new value for a given variable (from the above list)

$ upscmd -u admin -p <password> -l <ups>

... to get the list of commands that you can send to your UPS (e.g. battery tests).

You might see some options similar to these:

test.battery.start.deep - Start a deep battery test
test.battery.start.quick - Start a quick battery test
test.battery.stop - Stop the battery test

$ upscmd -u admin -p <password> -w <ups> test.battery.start.quick

... to initiate a 'quick' battery test

Example:

root@firewall:~ # upscmd -u admin -p xxxxxxxx -w cyberpower@192.168.1.1 test.battery.start.quick
SUCCESS

Hope this helps
Title: Re: UPS Settings and options
Post by: amd.64 on February 24, 2025, 11:03:32 PM
Thank you. I am trying to get SSH to work so I can try. Using the console would be difficult in my situation.
Title: Re: UPS Settings and options
Post by: Patrick M. Hausen on February 24, 2025, 11:26:27 PM
Quote from: amd.64 on February 23, 2025, 10:46:59 PMBoth in the Apcupsd widget on the dashboard and in status under the Apcupsd service it says the battery date is Dec 7, 2006. I just replaced the battery February 15. How can I update this?

Does this UPS have a network interface? If yes there should be a web UI for tasks like this. If it doesn't you probably need APC's proprietary software on Windows or Linux and a USB or serial connection.

For my Cyberpower UPS with RMCARD205 I can do it in the web UI.
Title: Re: UPS Settings and options
Post by: amd.64 on February 25, 2025, 03:28:15 AM
Quote from: Patrick M. Hausen on February 24, 2025, 11:26:27 PMDoes this UPS have a network interface? If yes there should be a web UI for tasks like this. If it doesn't you probably need APC's proprietary software on Windows or Linux and a USB or serial connection.

For my Cyberpower UPS with RMCARD205 I can do it in the web UI.

It does but it is only for surge protection (In and out). It does not receive an IP address.
Title: Re: UPS Settings and options
Post by: viragomann on February 25, 2025, 10:50:06 AM
I honestly haven't ever done this, but I'm running apcupsd on pfSense and once I came across this guide:

Quotessh into the netgate device (get to the shell prompt)
stop the apcupsd daemon by running "/usr/local/etc/rc.d/apcupsd.sh stop"
run apctest application "/usr/local/sbin/apctest"
select view/Change battery date
  system will display current battery date and prompt
select q to exit the apctest
restart the apcupsd daemon by running "/usr/local/etc/rc.d/apcupsd.sh start"

Maybe you can do the same on OPNsense. But possibly the paths are different here.
Title: Re: UPS Settings and options
Post by: OPNenthu on February 25, 2025, 05:52:32 PM
Quote from: Patrick M. Hausen on February 24, 2025, 11:26:27 PM
Quote from: amd.64 on February 23, 2025, 10:46:59 PMBoth in the Apcupsd widget on the dashboard and in status under the Apcupsd service it says the battery date is Dec 7, 2006. I just replaced the battery February 15. How can I update this?

Does this UPS have a network interface? If yes there should be a web UI for tasks like this. If it doesn't you probably need APC's proprietary software on Windows or Linux and a USB or serial connection.

For my Cyberpower UPS with RMCARD205 I can do it in the web UI.

This is my gripe with Cyberpower.  The RMCARD is a costly add-on (about as much as the UPS itself) and they only give some limited client-side software for the UPS over USB.  They have a free "PowerPanel Personal" product for Windows but it's very basic and certain functionality is locked behind a paywall or an upsell to "PowerPanel Cloud".

My UPS isn't connected to Windows currently but notice the "Battery Health" section:

PPPersonal.png

There is no option in the free product to set the battery replacement date. And they don't allow to set it over NUT cli with the USB-HID driver, either.  It returns "READONLY" from upsrw:

root@firewall:~ # upsrw -s battery.mfr.date -u admin -p xxxxxx cyberpower@192.168.1.17
Enter new value for battery.mfr.date: 01July2022
Unexpected response from upsd: ERR READONLY

Alas there is nothing like APCUPSD for Cyberpower that I'm aware of :(

...

Anyway, Patrick, I have a question about the RMCARD for future purchase consideration.  Do you know if Windows has a way to use that directly over the network to shut itself down on low power condition, or does it still rely on a NUT server for that?  If you're going to connect the UPS to a NUT server anyway (such as OPNsense) what is the advantage of the RMCARD?  Is it a more reliable connection than USBHID?  Or does SNMP just give more control and metrics?
Title: Re: UPS Settings and options
Post by: Fabian Wenk on February 25, 2025, 06:04:38 PM
I am not familiar with the APC you have, but I operate several APC Smart-UPS over the years with apcupsd. In the very old days (~2012) with an APC Smart-UPS 1000 (SUA1000I) it was possible to set a few parameters with the 'apctest' cli tool (make sure to stop apcupsd before).
Since they switched the protocol to modbus on the newer models access was very limited and I vaguely remember that they did add more possibilities to modbus with firmware upgrade on the APC. As with the Smart-UPS it is also possible to set the battery replace date through the on-device display / menu, I have never updated the firmware and also not tested on newer devices.
But maybe it is worth a try with 'apctest', as it is installed with apcupsd on OPNsense.