Using NUT with Ipfire

I understand there is no WUI for the NUT addon.

I am having trouble monitoring my Cyberpower UPS. It is straight forward, USB A to B cable connects CyberPower → IPfire.

I installed NUT with pakfire, IPFire 2.27 (x86_64) - Core Update 161

The driver is working fine,
monitoring is not working

> 
# /usr/sbin/upsdrvctl start
Network UPS Tools - UPS driver controller 2.7.4
Network UPS Tools - Generic HID driver 0.41 (2.7.4)
USB communication driver 0.33
Duplicate driver instance detected! Terminating other driver!
Using subdriver: CyberPower HID 0.4
using 'battery.charge' to set battery low state
using 'battery.runtime' to set battery low state

> # /usr/bin/upsc cyberpower@localhost ups.status
Error: Connection failure: Connection refused

> # upsc upsuser@localhost
Error: Connection failure: Connection refused

I will post my config below
>
**ups.conf**


[cyberpower]

	driver = usbhid-ups
	port = auto
	desc = "Cyberpower" 	
	offdelay = 20
	ondelay = 0
	ignorelb
	override.battery.charge.low = 20
	override.battery.charge.warning = 40
        pollinterval = 15
	
>
**upsd.conf**

LISTEN 127.0.0.1 3493

>
**upsd.users**

[upsuser]
              password="pass###"
              actions = SET
             instcmd = ALL

>
**upsmon,conf**

MONITOR cyberpower 1 upsuser pass### master
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h +0"
POLLFREQ 5
POLLFREQALERT 5
DEADTIME 15
POWERDOWNFLAG /etc/killpower

FWIW, I’m using the apcupsd addon with a CyberPower UPS. It works fine for me.

Thank you for your reply, I did try it, and was not working,

I guess I will give it another try,
Do I need to get rid of the NUT files before?

I can’t say about removing the NUT files – I’ve never installed it. Good luck

apcupsd addon is Not working for me

** Unable to communicate with the UPS on 127.0.0.1. **

apcupsd.conf

UPSTYPE usb
#DEVICE
UPSNAME Cyberpower
UPSCABLE usb
LOCKFILE /var/lock
UPSCLASS standalone
UPSMODE disable

Is it normal for WUI-Status-Services
to show NUT and APCUPSD to be “STOPPED” ?
If I click the green arrow, to start the service, nothing changes,
both will stay “STOPPED”

I found a typo in the apcupsd.conf
so its running but can’t read any data

/etc/init.d/apcupsd start

Starting apcupsd daemon… [ OK ]

Warning communications lost with UPS Cyberpower

|UPS Name: Cyberpower APCUPSD: Version 3.14.14 Status: COMM LOST|

WUI-IPfire-APC-UPS-status says

Last UPS Self Test: Not found
Last Test Date: Not found
Utility Voltage: Not found VAC
Line Minimum: Not found VAC
Line Maximum: Not found VAC
Output Freq: Not found Hz

Only one of them should be running at a time otherwise you will have two systems both trying to access the UPS at the same time.

If you are trying to evaluate apcupsd then I would uninstall nut. nut does a backup when being installed so if you re-install again leter then your conf file should be restored.

1 Like

Looking in my apcupsd.conf file I have DEVICE uncommented. The conf file says that for usb ups’s a blank DEVICE setting enables autodetection.

The rest of your conf settings look the same as mine (different ups but still usb based) and it is connected without issue.

1 Like

Thank you Adolf, will try that.

I uncommented and left it blank

DEVICE

restarted
/etc/init.d/apcupsd stop
Stopping apcupsd daemon…
/etc/init.d/apcupsd start

Warning communication lost with UPS Cyberpower

still says Communication lost

As a quick check if you run lsusb does the list of usb connections include your Cyberpower UPS? My APC UPS is shown when I do that.

Searching around I found another person having similar trouble as you. In the end he said that it was fixed after he fully switched off the UPS, including disconnecting it from the mains. Then when he started everything back up again his UPS usb connection was working again.

1 Like

Yes, Of course :wink: first thing I tried was
lsusb shows
Cyber Power System, Inc. PR1500LCDRT2U UPS

I will try shutting it off,and disconnecting completely when I get a chance one of the week-ends.

I just added the USB cable from my IPFire device to my existing Cyber Power CP1500PFCLCD. And here are the changes I made to apcupsd.conf:

[root@ipfire ~] # cat /etc/apcupsd/apcupsd.conf
...
UPSNAME Cyberpwr	# <- only 8 character allowed
UPSCABLE usb
UPSTYPE usb
#	leave DEVICE blank
DEVICE
...

These are the only changes I made to the default apcupsd.conf file. And it seems to work OK for me. I have not tested this yet (no test button and no test power down).

EDIT: Here is the screen I see in menu IPFire > APC-UPS status

1 Like

I changed the apcupsd.conf to match yours and restarted ApcUpsd but it still says “Communications with UPS lost.”

Thank you for trying :slight_smile:

@bonnietwin @jon

I was able to shutdown the firewall and disconnected Cyberpower from the mains,

Now APC-UPS status works, at least partially, just like Jon’s screenshot shows.

I wish, in the future, I could figure out how to make it gracefully shutdown devices,
right now the Cyberpower is 200 minutes strong, so it outlasted any power outages but eventually, it won’t.

Hey @trish,

I think the timer for the shutdown is somewhere in this section below. (I have not set mine up yet).

And I think the graceful shutdown comes from other software installed on the other devices. The UPS broadcasts a shutdown notice and devices react.

#
# ======== Configuration parameters used during power failures ==========
#

# The ONBATTERYDELAY is the time in seconds from when a power failure
#   is detected until we react to it with an onbattery event.
#
#   This means that, apccontrol will be called with the powerout argument
#   immediately when a power failure is detected.  However, the
#   onbattery argument is passed to apccontrol only after the 
#   ONBATTERYDELAY time.  If you don't want to be annoyed by short
#   powerfailures, make sure that apccontrol powerout does nothing
#   i.e. comment out the wall.
ONBATTERYDELAY 6

# 
# Note: BATTERYLEVEL, MINUTES, and TIMEOUT work in conjunction, so
# the first that occurs will cause the initation of a shutdown.
#

# If during a power failure, the remaining battery percentage
# (as reported by the UPS) is below or equal to BATTERYLEVEL, 
# apcupsd will initiate a system shutdown.
BATTERYLEVEL 5

# If during a power failure, the remaining runtime in minutes 
# (as calculated internally by the UPS) is below or equal to MINUTES,
# apcupsd, will initiate a system shutdown.
MINUTES 3

# If during a power failure, the UPS has run on batteries for TIMEOUT
# many seconds or longer, apcupsd will initiate a system shutdown.
# A value of 0 disables this timer.
#
#  Note, if you have a Smart UPS, you will most likely want to disable
#    this timer by setting it to zero. That way, you UPS will continue
#    on batteries until either the % charge remaing drops to or below BATTERYLEVEL,
#    or the remaining battery runtime drops to or below MINUTES.  Of course,
#    if you are testing, setting this to 60 causes a quick system shutdown
#    if you pull the power plug.   
#  If you have an older dumb UPS, you will want to set this to less than
#    the time you know you can run on batteries.
TIMEOUT 0

#  Time in seconds between annoying users to signoff prior to
#  system shutdown. 0 disables.
ANNOY 300

# Initial delay after power failure before warning users to get
# off the system.
ANNOYDELAY 60

# The condition which determines when users are prevented from
# logging in during a power failure.
# NOLOGON <string> [ disable | timeout | percent | minutes | always ]
NOLOGON disable

# If KILLDELAY is non-zero, apcupsd will continue running after a
# shutdown has been requested, and after the specified time in
# seconds attempt to kill the power. This is for use on systems
# where apcupsd cannot regain control after a shutdown.
# KILLDELAY <seconds>  0 disables
KILLDELAY 0

1 Like

Thank you Jon,

What software is there for example for IPFire router to gracefully shutdown?

from reading the config file options I got the impression the IPFire box is shutdown by the apcupsd add-on.

If during a power failure, the UPS has run on batteries for TIMEOUT
many seconds or longer, apcupsd will initiate a system shutdown.

1 Like