Is it possible to get the battery status of Bluetooth headphones connected to Linux? Android shows it so I was wondering if it was possible.
-
3See also https://stackoverflow.com/a/55008142/2907484 – Rmano May 18 '19 at 17:01
-
Quite an old answer, not sure still works or not! https://askubuntu.com/questions/20698/battery-status-not-showing – Novice Dec 12 '19 at 12:31
6 Answers
I am not sure about the state under Ubuntu, but under Arch Linux you do not need to write your own scripts to get bluetooth battery information nowadays.
The bluez package has experimental support for querying bluetooth headset battery data. Simply enable experimental features by editing
/etc/bluetooth/main.conf
and adding the following line to the [General]
section
Experimental = true
Then, you just need to restart the bluetooth service using
systemctl restart bluetooth
Reconnect to your device, and
bluetoothctl info
should now also show the battery status. e.g.
Device 28:11:A5:47:6C:6E (public)
Name: Cloud Walker
Alias: Cloud Walker
Class: 0x00240418
Icon: audio-headphones
Paired: yes
...
Battery Percentage: 0x3c (60)
The solution using upower as given by danjjl should also work now.
And now the battery level percentage should show up in Gnome Power settings dialog as well.

- 716
- 1
- 7
- 13

- 801
- 3
- 2
-
1Thanks, just got this working on Arch thanks to your answer! It also gets it showing in the Power settings UI for Gnome too! Ubuntu must have enabled the Experimental bit in their upstream of
bluez
. I just added some UI screenshots as well as example output frombluetoothctl info
. Oddly though,bluetoothctl info
only shows one device, e.g. not my MX Master mouse battery as well. I'm looking forward to these battery levels showing natively in the system tray settings dropdown too! – Elijah Lynn Sep 07 '22 at 21:58 -
1
-
1Didn't work for me on Ubuntu 20.04.5 LTS with 5.15.0-58-generic kernel. – Paloha Feb 03 '23 at 07:56
-
I was working to build a script and shows at status bar, but with this 50 % of work was skipped – ayelsew Apr 04 '23 at 21:51
-
4
-
2This approach of enabling experimental features works great. However, this specific method of editing the
/etc/bluetooth/main.conf
does not work for me, at all. The method that does work is editing the/lib/systemd/system/bluetooth.service
to add--experimental
flag, as can be seen in the docs. Cheers! – AneesAhmed777 May 21 '23 at 20:39 -
Did not work for me, but it might be because of Pipewire. Alirezas Python script also doesn't. – phil294 Jun 10 '23 at 13:11
-
-
-
@AneesAhmed777 Make sure to put the
Experimental=true
config in the[General]
section of/etc/bluetooth/main.conf
. The end of the file might not be the correct section. – Niklas Nov 19 '23 at 17:52 -
worked perfectly on Fedora 37, both bluetoothctl and gnome 43.9 – Beni Cherniavsky-Paskin Dec 14 '23 at 14:37
I wrote a simple python script that does the job. It uses AT commands to communicate with the device via RFCOMM and prints the battery level if the device is supported.
https://github.com/TheWeirdDev/Bluetooth_Headset_Battery_Level
(You need Python 3.6.0 or newer to run the script)
It might not work with all bluetooth headsets but I've provided a couple of workarounds in the 'Issues' page that might help.

- 351
-
3
-
Thank you! Do you have print screens, just want to see how its looks like. – Qui-Gon Jinn Oct 28 '20 at 04:25
-
@Qui-GonJinn it's a command line tool. It simply prints the battery level, for example something like this: Battery level for XX:YY:ZZ:AA:BB:CC is 80% – Alireza S.N Oct 28 '20 at 05:19
-
1Using port
.2
I get<MAC adress> is offline (16, 'Device or resource busy')
. Using other ports I get<MAC adress> is offline (111, 'Connection refused')
. – sancho.s ReinstateMonicaCellio Mar 30 '21 at 08:01 -
1Thank you for this. Worth adding that "bluetoothctl devices" shows the required MAC addresses – davidgo Jan 13 '22 at 19:47
-
@AlirezaS.N It gives me
bluetooth.btcommon.BluetoothError: [Errno 16] Device or resource busy
exception. (Trying to get battery status from Apple AirPods). – S.B Mar 14 '22 at 12:49
In ubuntu you can go simply to settings->power
to see the battery status of system and connected devices.
Yes, I know it's a Microsoft Bluetooth mouse on a Linux System ... but hey, Microsoft is the new cool company now ;)
This is what: systemctl status bluetooth
This is what: bluetoothctl
devices shows:
The JBL was disconnected and the Creative speaker is connected with power. So the resulting ones with batteries (Keychron and Mouse) show up in the settings->power
dialog.
NOTE:
If upower -d
not show the device, It's power level may not display in settings .
// I had a mouse shown, but a headphone not.
-
2Unfortunately, I don't see the first section "Devices" on my machine. I've the same Ubuntu20.04.1 LTS. – Rajesh Chaudhary Dec 11 '20 at 06:40
-
-
-
Hmm, seems you don't have any connected devices. Probably a last check if BT stack is running. You can check it with
systemctl status bluetooth
Which should state loaded and active. If that is the case you can usebluetoothctl
which open an internal cli. Enterdevices
which should give a list of the connected devices. I add the outputs for my system in the answer above. – klaas Dec 17 '20 at 11:58 -
I don't think so. I was connected to Bluetooth device & still connected now. Please see this once. https://imgur.com/a/HYgvg06 – Rajesh Chaudhary Dec 17 '20 at 16:59
-
3Seems to be dependent on the device. I found the issue and comment from the maintainer below in the gnome.org gitlab issues Source,see here: Quote: ".. the device needs to show up in the output of upower -d to show up in the Power Settings panel (whether that's a laptop or a desktop). Right now, this means only devices which export their battery status in the kernel, and Bluetooth LE devices which export the battery via the BATT profile are supported..." – klaas Dec 19 '20 at 21:12
upower
can be used from a terminal to list power devices, listening to device events and querying history and statistics.
If your device is listed by upower -e
you can run upower --dump
to retrieve the battery level of your device.
Here is a sample output:
$ upower --dump
...
Device: /org/freedesktop/UPower/devices/mouse_dev_C1_FC_26_13_A9_58
native-path: /org/bluez/hci0/dev_C1_FC_26_13_A9_58
model: MX Anywhere 2S
serial: C1:FC:26:13:A9:58
power supply: no
updated: Wed 31 Dec 1969 06:00:00 PM CST (1550719462 seconds ago)
has history: yes
has statistics: no
mouse
present: yes
rechargeable: no
state: unknown
warning-level: none
percentage: 50%
icon-name: 'battery-missing-symbolic'
...

- 6,465
-
22It did not show the bluetooth device, just the ac adapter, laptop battery and displaydevice. – gabs1bb3 Feb 27 '20 at 07:30
-
-
1@ÉdersonT.Szlachta not always. My phone can show the battery status of my device but Ubuntu (18.04) can't. – Saren Tasciyan May 31 '21 at 10:52
-
@gabs1bb3 Need to restart bluetooth daemon and reconnect the bluetooth device before upower method. – Akarsh Jain Mar 19 '23 at 05:32
I have developed a GUI application to get the battery level of a bluetooth headset. You can check it on: https://github.com/Coutj/Bluetooth_project.git

- 41
For Airpods devices download and run https://github.com/delphiki/AirStatus with:
git clone git@github.com:delphiki/AirStatus.git
cd AirStatus
pip3 install bleak
python3 main.py

- 1,610
- 14
- 23