📜 ⬆️ ⬇️

Configure the Ippon Backpower Pro UPS to automatically turn off and on

I was going to buy UPS for a home server for a long time, but the toad was constantly choking. That is, there was no special need for it, just somehow it was not human-like without a bespereboinik. In the end, I bought cheap Ippon Backpower Pro 500 and sat down to tune it up. Googling for a couple of minutes, I decided that the official drivers, written in java of a shaggy year of release, I didn’t like and decided to screw NUT .

Configured. It worked. One "but" - the enemy device stubbornly refused to turn off the power from the load.

That is, the scheme was conceived as follows:
  1. Power is lost - we work from the battery as much as we can;
  2. When the battery is discharged, we give the UPS a command to turn off after a couple of minutes and complete the work;
  3. The UPS shuts down power to the server and goes into suspend mode;
  4. When electricity appears in the network, the UPS will exit standby mode and supply power to the server;
  5. The server starts, because the corresponding option is set in the BIOS.

The idle UPS will work for a long time before overdischarge protection will work on it. It is clear that in such a situation the server will think that the power has not disappeared anywhere and will not automatically turn back on.
Spitting, I decided to install official drivers anyway. However, here I was waiting for a bummer. The official driver defined the type of UPS as “regular LINE-INT UPS”; for such devices, shutting down the UPS on a command was not supported. Only some other, apparently more sophisticated (and expensive) models were supported. Having depressed, I deleted the inconvenient official driver and put the NUT back, taking the hopeless source from the hopeless source.

Having slightly smoked the code of the driver and the Megatec protocol specs , which communicated with the iphone, I found that turning off the timer in the device is still implemented, albeit crookedly. In the specs, the command to turn off and then turn on the UPS looks like this:

S n R m cr

All in minutes, mind you. My particular instance of Ippon Backpower Pro 500 perceives the first value as a clock . Marriage is it, or so conceived, so that the enemies would not guess - I do not know. Thus, the minimum time interval that I can specify to turn off the UPS is 6 minutes instead of 6 seconds. Without knowing this feature, I entered the values ​​for shutdown for about 2-3 minutes, and the iphone dedicatedly set out to wait 2-3 hours before going into standby mode.

Next, I will give my configs to configure the UPS shutdown after a minimum time (6 minutes) after the battery is discharged. NUT allows you to monitor entire networks of bespereboynik, but I have a simple config:




driver = blazer_usb
port = auto
desc = "Ippon IBP"
default.battery.voltage.high = 13.60
default.battery.voltage.low = 10.60
offdelay = 6
ondelay = 7

The default.battery.voltage.high and default.battery.voltage.low values ​​are used to calculate the approximate battery charge in percent. Also, when the voltage drops to the level of default.battery.voltage.low, the system shutdown script is launched. Values ​​may vary on other UPSs. You can not specify them at first, but add after measuring the voltage when the UPS is fully charged and shortly before it is discharged. Values ​​can be obtained with the command upsc <_> . The name is indicated at the beginning of the section in square brackets (I have ippon ).

/etc/nut/upsd.conf - I have this file empty, all the default settings.


password = mypass
upsmon master
actions = SET
instcmds = ALL

This file sets permissions for various users. I have only one user with full rights.


MONITOR ippon@localhost 1 admin mypass master
SHUTDOWNCMD "/sbin/shutdown -Ph +0"
POWERDOWNFLAG /etc/killpower

Here you can set up tracking parameters for UPS and shutdown. In this file you need to pay attention to the values ​​of MONITOR (where it is indicated which UPS will be monitored by the daemon) and SHUTDOWNCMD (command for shutdown).

Since configs contain passwords for managing the UPS, the rights to read them should be allocated only to the root and the nut group.

That's all, with the disappearance of the mains voltage, the computer will work for some time (I have a headless machine on a dual-core AMD with a pair of screws running for about half an hour), then it will turn itself off, and after 6 minutes the uninterrupted power supply will turn off. When a power supply appears, the UPS will turn on and supply power to the load. True, I have a bad suspicion that if the power appears in the interval between turning off the computer and turning off the UPS, the whole plan will collapse, but there's nothing you can do. Is that buy bespereboynik cooler and more expensive.

Long uptime.

Source: https://habr.com/ru/post/102032/

All Articles