ioreg -c 'deviceName' |grep -i batterypercent
I tried this command using "Powerbeats Wireless" and "bluetoothaudiod" for the
'deviceName''s, but neither returned the
batterypercent. I tried
ioreg -c bluetoothaudiod |grep -i battery to get general information about the battery, and get this as a response:
| | +-o AppleSmartBatteryManager <class AppleSmartBatteryManager, id 0x100000250, registered, matched, active, busy 0 (0 ms), retain 7> | | +-o AppleSmartBattery <class AppleSmartBattery, id 0x100000252, registered, matched, active, busy 0 (0 ms), retain 6>
If I connect the headphones to my iPhone, the battery level immediately pops up on the toolbar. This leads me to believe that the device is broadcasting battery level, and that I should be able to access this information from my computer.
How can I check the battery level of my bluetooth connected headphones?
Initially I thought the issue was with the device name, but it seems
"Powerbeats Wireless" and
bluetoothaudiod work interchangeably. Just can't figure out how to access the
Looking at the Bluetooth docs, it seems there's a Battery Service which exposes the Battery State and Battery Level. The Battery Level can be read using the GATT Read Characteristic Value sub-procedure, so I need to figure out a way of interfacing with this service from the command line. I have a feeling
batterypercent may only be coded for standard peripherals (trackpad, mouse, keyboard), as all battery monitoring widgets I've tried are only compatible with such devices.
Revisiting this almost a year later. I know have a wireless trackpad & keyboard, and can see their battery levels perfectly fine ( in both the toolbar or the command line). Still unable to get the battery level from my headphones though, and not sure why :/