Communicating with an UPS

I decided this belonged in the pub more than anywhere else - as it isn’t exactly a problem! I have been in communication with APC, trying to find software for having my UPS tell me when the power is lost.

So far all I have from them is that the model I got is for ‘home use’ so all they have is versions for 3 kinds of Windows! This, despite the existence of Linux versions for other models. After I told them that the chances of Windows being allowed on my machines was pretty low, I got a link to some Mac app that can do it!

To save myself from crawling around on the floor to plug and unplug the power (while testing the output from its serial port) does anyone know of an app or command for doing this job? All I need is a signal that power dropped, and another if the power comes back…

Hard to believe this attitude exists on a hardware peripheral that is as far from OS specific as it gets - and that they claim proprietary information is a reason for not just telling me what it sends! (baud rate, encoding etc).

Your daily smile! Maybe should have posted in the Joke thread…

1 Like

I don’t think they all use the same protocol. APC has a lot of different products.

I’m sure they don’t - but whatever it is seems to be accessible to an existing app (3rd party?) on the Mac - so it can’t be terribly complicated. If I could crawl around, I could probably discover enough to code it myself - however clumsily…

Oh well - just have to hope I’m around and awake when the power drops!

Maybe something like this is what you might want.

or … go capture the code it sends from a windows machine :wink: ?

Might be - but appears to be touch old (2004?) - but I guess I have to try! Thanks for the heads-up - silly me I hadn’t looked there yet (still communicating with APC).

I suppose I could try - I still have my sister’s Win 7 Toshiba lappie (dual booting Arch) so anything is possible I guess. The Archwiki article with a systemd service might still hold the answer though… updates will be a while!

If something is system(d) readable, you will find it with udevadm. (man udevadm and wiki with several examples using udev rules).

IIRC when I tried to connect my UPS on desktop, I had seen a Battery section in Plasma Settings.

Or use Windows in a VM? Not sure if that works though.

I don’t mean to hijack this thread, but since we’re discussing UPS…

I intend to get one for my main desktop. I never had one, so I don’t really know what to look for. I get power outages a couple of times a year. With a USP, I am imagining something like this: when power is lost, an alarm would go off, and the battery ought to last at least 5 minutes so that I can save my work and shut down the PC gracefully, or if I’m AFK, it would shut down the PC automatically after a couple of minutes of power failure.

Any recommendations?

I think they last a lot longer than that depending on what UPS you get.

That’s what OP probably wants to do, find a way to make the computer (systemd/udevadm) to talk to the UPS. I suppose you never know until you know :joy:

2 Likes

What about this?

Edit: Maybe @dalto can hack it and make it work for Arch. :wink:
Edit2: Guess what it’s in the AUR!!

Edit: I see on the AUR page .

systemctl start pwrstatd
systemctl enable pwrstatd
pwrstat -pwrfail -shutdown off
1 Like

Pile of cash…More power + more time = :moneybag:

:moneybag: = bloat!

1 Like

Does that work with APC? CyberPower is a competitor.

I don’t know? That’s why i thought maybe you can hack it? :wink:

Edit: There is also this?

1 Like

@Kresimir
Don’t know if this is helpful?

https://tldp.org/HOWTO/html_single/UPS-HOWTO/

1 Like

@freebird54
I think this is one for mac and it’s also in the AUR.

Edit: There’s even a manual.

http://www.apcupsd.org/

I’ve had APC several times over the years (currently have 3) and they have always performed well. The time varies with the load and capability - my current purchase claims 150 minutes - but 15-20 is more usual with home-style (ie inexpensive) systems. The higher end (?) ones can also signal your computer to shut down - or even do it themselves, depending) but all of them give you a chance to do it yourself.

The one I got, besides offering so long a time, has enough oomph to carry 2 systems on it - although only one monitor without pushing the limits a bit. Luckily, I use a KVM switch for the monitor, and run both systems on the one, so that matches up well.

I have yet to find software for the communications with the computer - but this thread has provided me with some possibilities if APC doesn’t talk sense soon! I’ll be testing it on the laptop using the Archwiki - and the stuff @ricklinux posted might also be possible - we’ll see. All I want is the signal that power is going down (and preferably if it comes back!) so I can start a timer myself to shutdown both systems (ssh to the rescue) that will cancel and reset if power returns.

Just remember that most of the decent ones provide excellent surge protection as well - usually some plugins are battery backed, and ALL are surge protected. DO NOT put something like your printer on the battery side - and I don’t think I would recommend gaming on battery power either (too much draw).

Well - on to testing…

BTW - the mention of apcupsd in the Archwiki (and for the Mac) gives me some hope for it. It only remains to be seen if the ‘home’ UPS from APC supports enough of the protocol to be useful. Like I said - testing… :grin:

1 Like