Monitoring of small UPS over USB port

I have small offline PowerWalker UPS in one of the service rooms in my apartment in order to keep some home gadgets safe during power outages. As the other small UPS appliances I had in the past this one is not an exception – the settings are reset if the UPS run out of battery or being restarted. This includes the beeper settings. So if for some reason the UPS is restarted and the next night when you fall asleep late it is most likely the energy supply company to make their maintenance and turn off your house for some time and you will be bring up by this annoying beeper. Well at this moment the first solution that come to my mind was to open the UPS and to take off the beeper, but that wasn’t the best solution as many bad things may happened during this hardware intervention.

One of my friends point me to NUT (Network UPS Tools). Having small debian server around the UPS I immediately looked for a cable and connected the UPS to one of the free USB ports and ‘voala’ after some small config adjustments everything worked well and I can put some cronjobs to disable the beeper. Here is what I did:

Installation of the NUT server:

$ apt install nut

Updating of /etc/nut/nut.conf to configure the server as standalone instance:

MODE=standalone

Checking the nut-scanner for the UPS settings:

# nut-scanner
SNMP library not found. SNMP search disabled.
Neon library not found. XML search disabled.
IPMI library not found. IPMI search disabled.
Scanning USB bus.
No start IP, skipping NUT bus (old connect method)
[nutdev1]
	driver = "usbhid-ups"
	port = "auto"
	vendorid = "06DA"
	productid = "FFFF"
	product = "Offline UPS"
	serial = "000000000"
	vendor = "PPC"
	bus = "002"

I grab the settings from the nut-scanner and put them in /etc/nut/ups.conf:

maxretry = 3

[ups]
	driver = "usbhid-ups" 
	port = "auto" 
	vendorid = "06DA" 
	productid = "FFFF" 
	product = "Offline UPS" 
	serial = "000000000" 
	vendor = "PPC"
        bus = "002"

Update of /etc/nut/upsd.conf:

MAXAGE 40

Update of /etc/nut/upsmon.conf

MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h +0"
POLLFREQ 20
POLLFREQALERT 10
HOSTSYNC 15
DEADTIME 60
POWERDOWNFLAG /etc/killpower
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5

And finally adding a new user in /etc/nut/upsd.users:

[admin]
     password = 123456
     actions = SET
     instcmds = ALL

Restarting the NUT server to load updated configs:

# /etc/init.d/nut-server restart

Checking the current parameters of the UPS with the upsc command line client:

# upsc ups
Init SSL without certificate database
battery.charge: 100
battery.runtime: 2117
battery.type: PbAc
device.mfr: PPC
device.model: Offline UPS HID UPS
device.serial: 000000000   
device.type: ups
driver.name: usbhid-ups
driver.parameter.bus: 002
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.product: Offline UPS
driver.parameter.productid: FFFF
driver.parameter.serial: 000000000
driver.parameter.synchronous: no
driver.parameter.vendor: PPC
driver.parameter.vendorid: 06DA
driver.version: 2.7.4
driver.version.data: MGE HID 1.40
driver.version.internal: 0.41
input.voltage: 234.0
outlet.1.status: on
output.frequency: 50.5
output.frequency.nominal: 50
output.voltage: 234.0
output.voltage.nominal: 230
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.delay.start: 30
ups.load: 15
ups.mfr: PPC
ups.model: Offline UPS HID UPS
ups.power.nominal: 3
ups.productid: ffff
ups.serial: 000000000   
ups.status: OL
ups.test.result: No test initiated
ups.timer.shutdown: 0
ups.timer.start: 0
ups.type: offline / line interactive
ups.vendorid: 06da

Disabling the beeper:

# upscmd -u admin -p 123456 ups beeper.disable

Check other available commands:

# upscmd -l ups
Instant commands supported on UPS [ups]:
beeper.disable - Disable the UPS beeper
beeper.enable - Enable the UPS beeper
beeper.mute - Temporarily mute the UPS beeper
beeper.off - Obsolete (use beeper.disable or beeper.mute)
beeper.on - Obsolete (use beeper.enable)
load.off - Turn off the load immediately
load.off.delay - Turn off the load with a delay (seconds)
load.on - Turn on the load immediately
load.on.delay - Turn on the load with a delay (seconds)
shutdown.return - Turn off the load and return when power is back
shutdown.stayoff - Turn off the load and remain off
shutdown.stop - Stop a shutdown in progress
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

After writing writing a small bash script to check the nut server and restart it if the UPS connection fails for some reason and disabling the beeper I put it as a cronjob and fall to sleep like a baby without annoying beeper sounds 😀

This entry was posted in IT and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *