2

System Preferences in Sierra seems to know when a UPS is present. How do I check this from the command line?

2

Use the command system_profiler SPPowerDataType | grep "UPS Installed".

This will return something along the lines of UPS Installed: No

| improve this answer | |
2

You can use Power Manager's pmctl tool to check for a connected UPS, see Scripting Batteries and UPS on Mac OS X.

pmctl can output in a range of formats to make scripted parsing easier, use the -f flag for this:

  • JSON
  • perl
  • XML

Power Manager scripting UPS

Alternatively, you could search the output of system_profiler SPUSBDataType to find the matching UPS.

I wrote Power Manager, so feel free to ask technical questions.

| improve this answer | |
1

Parsing the output of system_profiler SPPowerDataType provides a line status UPS Installed : Yes | No which seems to be flipping with me (un)plugging the USB cable from the UPS.

| improve this answer | |
  • Is this supposed to be part of your question? Perhaps you should edit the question to add this as extra detail and delete this as an answer. – Monomeeth Feb 7 '17 at 22:22
  • 1
    No. It's the answer to my question, which I found minutes after posting the question :) – Rob de Jonge Feb 8 '17 at 2:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .