How to find battery level for bluetooth headphone?

Asked by Junior Martins

I want to see how much battery my Edifier W800BT headphone has left, and I can see it normally on my android cell phone.

The headphone's battery level doesn't show on the Control Center's Energy panel, but it shows as connected in the Bluetooth panel.

I've read some StackOverflow questions about it, and tried the script provided in <https://github.com/TheWeirdDev/Bluetooth_Headset_Battery_Level>, which just errors out with "[Errno 111] Connection refused" (sometimes it also disconnects my headphone, sometimes not) for any port from 1 to 100.

I've also tried the GNOME shell extension provided in <https://extensions.gnome.org/extension/3991/bluetooth-battery/>, but it just shows "refused".

OUTPUTS:
>>>lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 21.04
Release: 21.04
Codename: hirsute

>>>dpkg --status bluez | grep '^Version:'
Version: 5.56-0ubuntu4.2

>>>upower -e
/org/freedesktop/UPower/devices/line_power_ACAD
/org/freedesktop/UPower/devices/battery_BAT1
/org/freedesktop/UPower/devices/DisplayDevice

>>>upower --version
UPower client version 0.99.11
UPower daemon version 0.99.11

>>>ls /sys/class/power_supply
ACAD BAT1

>>>bluetoothctl devices
Device 5C:C6:E9:1F:1D:23 EDIFIER W800BT

>>> bluetoothctl info
Device 5C:C6:E9:1F:1D:23 (public)
 Name: EDIFIER W800BT
 Alias: EDIFIER W800BT
 Class: 0x00240404
 Icon: audio-card
 Paired: yes
 Trusted: yes
 Blocked: no
 Connected: yes
 LegacyPairing: no
 UUID: Headset (00001108-0000-1000-8000-00805f9b34fb)
 UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
 UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
 UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
 UUID: Handsfree (0000111e-0000-1000-8000-00805f9b34fb)

>>>dbus-send --print-reply=literal --system --dest=org.bluez /org/bluez/hci0/dev_5C_C6_E9_1F_1D_23 org.freedesktop.DBus.Properties.Get string:"org.bluez.Battery1" string:"Percentage"
Error org.freedesktop.DBus.Error.InvalidArgs: No such interface 'org.bluez.Battery1'

Question information

Language:
English Edit question
Status:
Open
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Bernard Stafford (bernard010) said :
#1

https://askubuntu.com/questions/1117563/check-bluetooth-headphones-battery-status-in-linux
Settings -> Power look at battery status of system and connected devices. It will list the % of battery.

Revision history for this message
Junior Martins (jrom) said (last edit ):
#2

I don't know how to add attachments, my headphone battery levels don't show on the Settings' Energy Panel (sorry I called it Control Center by mistake), only my laptop's battery levels. As for the answer in the linked question:

One of them points out:
"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." <https://askubuntu.com/a/1297019/1400408>, which is the case for my headphone, so this might be related to it not appearing in the Settings window.

The other answers point to this script <https://github.com/TheWeirdDev/Bluetooth_Headset_Battery_Level>, which didn't work for me as mentioned, and another one, <https://github.com/Coutj/Bluetooth_project.git>, which is a pyQT GUI wrapper based on the first script.
I tried it but doesn't display my headphone's name when I press "Load" (there is also no output on the command line), I tried connecting my computer to my cellphone, and it blinked for about 15s, but also didn't display anything, I tried also importing it to at least see the intended output, which is posted below (I don't know the actual input for get_battery_level(), but I tried replicating it to no avail.

outputs:

>>>upower --dump
Device: /org/freedesktop/UPower/devices/line_power_ACAD
  native-path: ACAD
  power supply: yes
  updated: seg 23 ago 2021 19:06:23 (3552 seconds ago)
  has history: no
  has statistics: no
  line-power
    warning-level: none
    online: yes
    icon-name: 'ac-adapter-symbolic'

Device: /org/freedesktop/UPower/devices/battery_BAT1
  native-path: BAT1
  vendor: SANYO
  model: AL15A32
  serial: 18558
  power supply: yes
  updated: seg 23 ago 2021 20:04:29 (66 seconds ago)
  has history: yes
  has statistics: yes
  battery
    present: yes
    rechargeable: yes
    state: fully-charged
    warning-level: none
    energy: 13,468 Wh
    energy-empty: 0 Wh
    energy-full: 13,468 Wh
    energy-full-design: 37 Wh
    energy-rate: 8,7764 W
    voltage: 17,237 V
    percentage: 100%
    capacity: 36,4%
    technology: lithium-ion
    icon-name: 'battery-full-charged-symbolic'

Device: /org/freedesktop/UPower/devices/DisplayDevice
  power supply: yes
  updated: seg 23 ago 2021 19:06:29 (3546 seconds ago)
  has history: no
  has statistics: no
  battery
    present: yes
    state: fully-charged
    warning-level: none
    energy: 13,468 Wh
    energy-full: 13,468 Wh
    energy-rate: 8,7764 W
    percentage: 100%
    icon-name: 'battery-full-charged-symbolic'

Daemon:
  daemon-version: 0.99.11
  on-battery: no
  lid-is-closed: no
  lid-is-present: yes
  critical-action: HybridSleep

>>>python
Python 3.9.5 (default, May 11 2021, 08:20:37)
[GCC 10.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from external_threads import *
>>> blueClass.get_bluetooth_devices()
[]
>>>blueClass.get_battery_level({"address": "5C:C6:E9:1F:1D:23".replace(":", "_"), "port": 1})
>>>

Revision history for this message
Bernard Stafford (bernard010) said :
#3

https://askubuntu.com/questions/1056094/ubuntu-18-04-show-bluetooth-connected-device-battery-status
"You can go to settings>Power and there you should see connected devices and their battery"
https://askubuntu.com/questions/865737/how-to-show-battery-percentage-of-a-bluetooth-connected-gadget-headphone
Open a terminal [ctl+alt+t] Type [copy-paste}
cat /sys/class/power_supply/_deviceId_/capacity

Revision history for this message
Junior Martins (jrom) said :
#4

It doesn't appear in Settings > Power.

Outputs:

>>>cat /sys/class/power_supply/_deviceId_/capacity
cat: /sys/class/power_supply/_deviceId_/capacity: Arquivo ou diretório inexistente

>>>ls /sys/class/power_supply/
ACAD BAT1

Revision history for this message
Launchpad Janitor (janitor) said :
#5

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Junior Martins (jrom) said :
#6

Please reopen the question, it's still not solved.
________________________________
De: <email address hidden> <email address hidden> em nome de Launchpad Janitor <email address hidden>
Enviado: quinta-feira, 16 de setembro de 2021 06:05
Para: <email address hidden> <email address hidden>
Assunto: Re: [Question #698455]: How to find battery level for bluetooth headphone?

Your question #698455 on Ubuntu changed:
https://answers.launchpad.net/ubuntu/+question/698455

    Status: Open => Expired

Launchpad Janitor expired the question:
This question was expired because it remained in the 'Open' state
without activity for the last 15 days.

--
If you're still having this problem, you can reopen your question either
by replying to this email or by going to the following page and
entering more information about your problem:
https://answers.launchpad.net/ubuntu/+question/698455

You received this question notification because you asked the question.

Revision history for this message
Launchpad Janitor (janitor) said :
#7

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Junior Martins (jrom) said :
#8

Please reopen the question, it's still not solved.
________________________________
De: <email address hidden> <email address hidden> em nome de Launchpad Janitor <email address hidden>
Enviado: sábado, 2 de outubro de 2021 05:55
Para: <email address hidden> <email address hidden>
Assunto: Re: [Question #698455]: How to find battery level for bluetooth headphone?

Your question #698455 on Ubuntu changed:
https://answers.launchpad.net/ubuntu/+question/698455

    Status: Open => Expired

Launchpad Janitor expired the question:
This question was expired because it remained in the 'Open' state
without activity for the last 15 days.

--
If you're still having this problem, you can reopen your question either
by replying to this email or by going to the following page and
entering more information about your problem:
https://answers.launchpad.net/ubuntu/+question/698455

You received this question notification because you asked the question.

Revision history for this message
Launchpad Janitor (janitor) said :
#9

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Junior Martins (jrom) said :
#10

Please reopen, the question is still not solved.
________________________________
De: <email address hidden> <email address hidden> em nome de Launchpad Janitor <email address hidden>
Enviado: segunda-feira, 18 de outubro de 2021 06:11
Para: <email address hidden> <email address hidden>
Assunto: Re: [Question #698455]: How to find battery level for bluetooth headphone?

Your question #698455 on Ubuntu changed:
https://answers.launchpad.net/ubuntu/+question/698455

    Status: Open => Expired

Launchpad Janitor expired the question:
This question was expired because it remained in the 'Open' state
without activity for the last 15 days.

--
If you're still having this problem, you can reopen your question either
by replying to this email or by going to the following page and
entering more information about your problem:
https://answers.launchpad.net/ubuntu/+question/698455

You received this question notification because you asked the question.

Can you help with this problem?

Provide an answer of your own, or ask Junior Martins for more information if necessary.

To post a message you must log in.