OH3: Network UPS Tools

  • Platform information:
    • Hardware: Raspberry Pi 4 Model B Rev 1.1 ; 4GB memory
    • Host: Linux openhabian 5.15.76-v7l+ #1597 SMP Fri Nov 4 12:14:58 GMT 2022 armv7l GNU/Linux
    • Distro: Raspbian GNU/Linux 11 (bullseye)
    • openjdk version “11.0.18” 2023-01-17
    • OpenJDK Runtime Environment (build 11.0.18+10-post-Raspbian-1deb11u1)
    • OpenJDK Server VM (build 11.0.18+10-post-Raspbian-1deb11u1, mixed mode)
  • OH Version: 3.4.3 (Build)
    • Installation method: openhabian

I have installed Network UPS Tools for the CyberPower UPS 600E connected to the openHABian Pi.

As I understand it, the ups.conf contains the parameters ondelay and offdelay to shutdown and bring up the Pi.
The default seems 600 seconds or ten minutes.
Is this how it actually works? (Will it shutdown and bring up the Pi?)
(It’s time I get a test machine :frowning:)

Also, the UPS Battery Runtime is listed as 4000 seconds or 1 hour 6 minutes. This is load dependent; and as I am running the UPS w/o the Pi being powered by it (though USB is connected). Given there is zero load, does this mean:
a) the UPS runs itself down over an hour?
b) If the Pi is connected, this time should be shorter

I also see these parameters:

  override.battery.charge.low = 30
  override.battery.charge.warning = 35

I reckon these need adjusting based on the actual load of the UPS?!

Does the UPS, based on the default configuration, come back on after the power is restored? I assume the USP will charge its battery, before coming on; to be ready, in case the power fails again?!


Also, and this may warrant a different post (or report on git)… the option in the openhabian-config to install nut seems incomplete. While it installs nut, it does not configure it properly, omitting to set LISTEN 127.0.0.1 3493 in the upsd.conf, to allow openHABian to communicate with it.

Just to avoid confusion, it’s Network UPS Tools (NUT).

When configured correctly, it will gracefully shutdown the Pi for sure. You want to make sure the time isn’t so long that the UPS runs out of power before the Pi can safely shutdown. You can also control the order that each machine shuts down in when you have more than one connected to the same ups (one becomes the NUT server and the rest become monitors).

The startup I’m not sure and I think it depends on how “smart” the UPS is. The problem is that once the RPi shuts down it won’t try to start up again until it loses power and the power is restored. If the RPi shuts down but the UPS never stops supplying power, when mains power returns the RPi remains off because it never lots power.

There’s a bunch of tutorials on this online here and there. UPS specially built for RPis I think will cycle the power on the RPi when power is restored and the RPi isn’t running.

I don’t know but the UPS has it’s own systems which consume power even when nothing is connected. It seems like it should last significantly longer than an hour without any load outside of itself but :person_shrugging: .

I would expect so.

Probably. If it’s just the RPi then you can probably go lower as an RPi can run for a pretty long time on 30% charge.

You’ll need to experiment. Optimizing your UPS config requires some measurements and tuning.

1 Like

I think that’s worth a bug report. I’ve been meaning to try that option out, but I’ve stalled on rewriting the openHABian docs due to non-OH priorities.

My very small UPS powers my RPi 4, modem, and router. This enables OH to send me a notification when power is lost and, if the RPI hasn’t shut down, when it’s restored. And since there are other devices on the same UPS, they will continue to deplete the battery after the RPi shuts down. This is good (in my opinion), because in a long outage the UPS will turn off, and when power is restored the RPi will turn on automatically.

It could be a bad thing if there was a sudden, second outage, but that’s never happened to me. Where I live, when the power is restored it doesn’t fail again.

1 Like

Yes, apologies; have corrected my post, to allow for proper search results.

Yes, it seems that way.

I actually worked from your post, hence, I did not have to figure out to add the LISTEN 127.0.0.1 3493 statement.

I live in a rural area, where power could be flawless for a year, and at other times brownouts and blackouts are frequent, but mainly coupled with the bad weather and falling trees.

On this note, that you are using the same UPS and Pi, what is your maximum runtime, and did you change the values I mentioned? Thanks.

I haven’t looked at that tutorial in awhile, and I see that this is under “3.1 Adding a second UPS”. If so, I wouldn’t expect openHABian to configure that line, since it’s an additional step for the second UPS. Or did you need it even with a single UPS?

I don’t think I changed any of the defaults, but I have changed the UPS since writing that tutorial. I just rely on the battery.charge.low to tell NUT Monitor when to shut down the RPi, so I have no idea about actual runtimes.

Thanks… yes, it is the first UPS. I had a comms error, which went away after adding the statement.

Yes, I can live with that too; hence, will do so too.

Interesting. I’ll keep this in mind when I try it out.