Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rjalex

macrumors 6502
Original poster
Mar 27, 2011
275
63
Rome, Italy
I have an APC UPS-700 connected to my Mac Mini M1. The current battery level show in the "Energy Saver" control panel.

Is there an API or a utility to fetch this level at will from a python program?

Thank you
 
I do not know about an API, but you can enable the services you want to use on the ups and then use these from python to probably get the information. E.g. SSH (via spur) or telnet (via telnetlib or xtelnetto) is one option - or you can e.g. compile/use apscupsd.

Something like:

import spur shell = spur.SshShell(hostname="ups.host.name", username="ups.user", password="password") result = shell.run(["echo", "-n", "hello"]) #execute the desired command here print result.output # prints hello #then get the result

I think that you can easily list the commands available on your ups after connecting to it via SSH from e.g. the terminal, otherwise, as usual, the manual might offer specific information here (?) 🤓😎
 
Hey thanks so much for chiming in. I am stumped. My UPS is the following APC brand model

Back-UPS ES 700G FW:871.O3 .I USB FW:O3 and I am pretty sure it does not have any TCP/IP hw, it's just connected via USB to my Mac.

Am I getting this wrong? Take care.
 
Hey thanks so much for chiming in. I am stumped. My UPS is the following APC brand model

Back-UPS ES 700G FW:871.O3 .I USB FW:O3 and I am pretty sure it does not have any TCP/IP hw, it's just connected via USB to my Mac.

Am I getting this wrong? Take care.
Probably not. 🤓 Sorry, I did not look up your specific model before, at my work place we use other APC models - but you should be able to use apscupsd. Might have to use brew to install.
 
  • Like
Reactions: rjalex
Thanks a lot. I had just stumbled in apscupsd myself :) See it seemingly stopped dev in 2016. Wonder if it works with Ventura. In case it doesn't I can hook it up to a Raspberry with Linux though. Take care.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.