If you use a wireless keyboard, mouse or trackpad, or have a UPS connected to your Mac, you might wonder how often macOS checks their charge and functional status. The answer is often, typically every 2-5 seconds. You can follow those checks in the log by listing entries for the subsystem com.apple.BatteryCenter
.
If there's a UPS connected, they typically start with a series of entries from com.apple.iohid
to obtain information about whether the current power source is AC, and whether the UPS is charging or discharging. The list of connected devices is then obtained, and each of their power sources is checked, one at a time.
For example, an APC BackUPS UPS might be detailed as:
- Accessory Identifier = "4B1837P41014 ";
- Current Capacity = 100;
- Delayed Remove Power = "-1";
- Enable Audible Alarm = 2;
- Is Charging = 0;
- Is Present = 1;
- Max Capacity = 100;
- Name = "Back-UPS XS 1400U FW:926.T2 .I USB FW:T2 ";
- Power Source ID = 31719424;
- Power Source State = "AC Power";
- Product ID = 2;
- Set Required Voltage = 230;
- Time to Empty = 26;
- Transport Type = USB;
- Type = UPS;
- Vendor ID = 1309;
- Voltage = 246000;
This is a CyberPower UPS:
- Accessory Identifier = CRWPP2000045;
- Current Capacity = 100;
- Delayed Remove Power = "-1";
- Enable Audible Alarm = 2;
- Is Charging = 1;
- Is Present = 1;
- Max Capacity = 100;
- Name = CP1300EPFCLCD;
- Power Source ID = 24379392;
- Power Source State = "AC Power";
- Product ID = 1281;
- Set Required Voltage = 230;
- Startup Delay = "-1";
- Time to Empty = 37;
- Transport Type = USB;
- Type = UPS;
- Vendor ID = 1892;
- Voltage = 240000;
Wireless input devices return a slightly different list, such as:
- Accessory Category = Keyboard;
- Accessory Identifier = "c0-a5-3e-03-61-e3";
- Current Capacity = 97;
- Is Charging = 0;
- Is Present = 1;
- Max Capacity = 100;
- Name = "Magic Keyboard with Numeric Keypad";
- Power Source ID = 24379393;
- Power Source State = "Battery Power";
- Product ID = 620;
- Transport Type = Bluetooth;
- Type = "Accessory Source";
- Vendor ID = 76;
Figures for Current Capacity are then displayed in Energy Saver settings for a UPS, and in Bluetooth settings for wireless keyboards, mice and trackpads.
BatteryCenter is part of Apple's Private Frameworks, and its information isn't available directly except in these log entries, although some is accessible in System Information and settings, while the pmset
command tool is concerned with Energy Saver settings for the UPS. Unfortunately, none of the information available is comparable to SMART health indicators: a couple of weeks after the APC UPS appeared to be working normally, it suddenly decided that its battery had died and needed replacement.
Almost exactly four years ago, I reported that these periodic checks, then using slightly different process names, continued throughout attempts to sleep. As this defeats the purpose of sleep, I there suggested that there's little point in trying to let a desktop Mac try to sleep when its connected to a UPS.
Finally, I wonder whether there's any interest in making information from UPS log entries more readily available?