maniacx / Bluetooth-Battery-Meter

A Gnome extension featuring indicator icons in system tray, serving as meter for Bluetooth device battery levels and providing detailed battery levels via icon/text in the Bluetooth quick settings menu.
https://extensions.gnome.org/extension/6670/bluetooth-battery-meter/
GNU General Public License v3.0
107 stars 11 forks source link

Issue with level not updating #38

Closed karypid closed 1 month ago

karypid commented 1 month ago

Hello,

I have headphones from Austrian Audio which don't seem to update their battery level. When I connect, I see a correct value, but over time the level does not update. For example, if I connect at 60%, after a few hours I would hope the display would update to show they have dropped at 40%, but the value is stuck there forever. Only if I power off and then back on (so that the speakers reconnect) does the battery level update.

I am not sure if this is a problem with the headphones themselves, or the extension. Unfortunately I do not have other headphones to test...

Here is the output of the info command:

> bluetoothctl info
Device xx:xx:xx:xx:xx:xx (public)
    Name: Hi-X25BT
    Alias: Hi-X25BT
    Class: 0x00240418 (2360344)
    Icon: audio-headphones
    Paired: yes
    Bonded: yes
    Trusted: yes
    Blocked: no
    Connected: yes
    LegacyPairing: no
    UUID: Serial Port               (00001101-0000-1000-8000-00805f9b34fb)
    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: Advanced Audio Distribu.. (0000110d-0000-1000-8000-00805f9b34fb)
    UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
    UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
    UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
    UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
    UUID: Immediate Alert           (00001802-0000-1000-8000-00805f9b34fb)
    UUID: Link Loss                 (00001803-0000-1000-8000-00805f9b34fb)
    UUID: Tx Power                  (00001804-0000-1000-8000-00805f9b34fb)
    UUID: Battery Service           (0000180f-0000-1000-8000-00805f9b34fb)
    Modalias: bluetooth:v000ApFFFFdFFFF
    Battery Percentage: 0x32 (50)

Is there some command that would force-refresh the power-level reading?

maniacx commented 1 month ago

~~ In bluez it does show the Battery level reading.

Try these few steps

  1. Disable the extension

  2. reset the gsettings. by using the below command.

    gsettings --schemadir /home/$USER/.local/share/gnome-shell/extensions/Bluetooth-Battery-Meter@maniacx.github.com/schemas reset-recursively org.gnome.shell.extensions.Bluetooth-Battery-Meter
  3. Enable the extension.

  4. Check the Bluettooth battery meter extension preferances

  5. In General tab, make sure "Enable bluetooth device battery indicator" is enabled. https://maniacx.github.io/Bluetooth-Battery-Meter/#system-tray-indicators

  6. In General tab, make sure "Show bluetooth device Battery Icon" is enabled. https://maniacx.github.io/Bluetooth-Battery-Meter/#display-battery-level-icon-in-bluetooth-quick-settings-menu

  7. Also in Device tab, check if your headphone is list. If it is, select Show All https://maniacx.github.io/Bluetooth-Battery-Meter/#per-device-settings

By default, all these setting will be enabled one you reset, but just confirm. Also let me know if your headphone doesnt show in the List.

If it still doesnt show. send me some details regarding you linux enviroment.

gnome-shell --version
uname -r
bluetoothctl --version

~~

maniacx commented 1 month ago

Ok. I apologize i didn't read your message correctly.

I seems your issue, is battery level not updating after few hour. So ignore my previous post.

You will have to determine if it is extension issue, or headphones/bluez issue.

One way to test, is simply check using bluetoothctl info

When you see the extension is not updating, the battery level, simply run bluetoothctl info command and check if battery level displayed in the command matches, the battery level in the extension.

If it battery level in bluetoothctl doesn't match the battery level shown in extension, then it is the extension problem. Let me know if it is ? I will try and solve the issue.

karypid commented 1 month ago

I think I understood your instructions. I have the headphones charging right now. They are connected and show 30% level. I am running:

 while true ; date ; bluetoothctl info | grep "Battery Percentage" ; sleep 600 ; end
Tue  8 Oct 17:06:47 BST 2024
    Battery Percentage: 0x1e (30)
...

I expect over time the value to increase. If it does and the extension is still stuck at 30%, this is likely an extension issue. If the command keeps returning 30% though, I guess that indicates an issue with the headphones. I will update after an hour.

karypid commented 1 month ago

Ok, it appears this is an issue with my headphones. I charged them for an hour (while listening via BT, they are able to do that) and the red charging light turned off in less than an hour (indicating they are fully charged) but on the command line I got:

> while true ; date ; bluetoothctl info | grep "Battery Percentage" ; sleep 600 ; end
Tue  8 Oct 17:06:47 BST 2024
    Battery Percentage: 0x1e (30)
Tue  8 Oct 17:16:47 BST 2024
    Battery Percentage: 0x1e (30)
Tue  8 Oct 17:26:47 BST 2024
    Battery Percentage: 0x1e (30)
Tue  8 Oct 17:36:47 BST 2024
    Battery Percentage: 0x1e (30)
Tue  8 Oct 17:46:47 BST 2024
    Battery Percentage: 0x1e (30)
Tue  8 Oct 17:56:47 BST 2024
    Battery Percentage: 0x1e (30)
Tue  8 Oct 18:06:47 BST 2024
    Battery Percentage: 0x1e (30)
Tue  8 Oct 18:16:47 BST 2024
    Battery Percentage: 0x1e (30)

At this point I unplugged the charging cable but it made no difference (was still seeing 30% level). I turned the headphones off/on and reconnected and immediately the extension icon reappeared showing 100% and on command line I got:

> date ;bluetoothctl info | grep "Battery Percentage"
Tue  8 Oct 18:17:23 BST 2024
    Battery Percentage: 0x64 (100)

So unfortunately it seems like the headphones somehow don't update their battery level. It's good that they are rated to last ~30 hours and charge in less than 1 hour. I never really run out, but it would be nice to know the actual level...

maniacx commented 1 month ago

Just curious. Which OS are you using? Fedora?

Or to be more specific, what audio server are you using? Pipewire or Pulseaudio? For headset/ audio devices, Battery information process using rfcomm in pipewire/pulse audio, which then reports to bluez.

karypid commented 1 month ago

It is basically Fedora, but to be specific it's Bluefin (bluefin-dx-nvidia:stable tree).

> rpm -qa | grep -E "pipewire|pulseaudio"
pulseaudio-libs-16.1-8.fc40.x86_64
pulseaudio-utils-16.1-8.fc40.x86_64
pulseaudio-libs-glib2-16.1-8.fc40.x86_64
pipewire-1.0.8-1.fc40.x86_64
pipewire-libs-1.0.8-1.fc40.x86_64
pipewire-jack-audio-connection-kit-libs-1.0.8-1.fc40.x86_64
pipewire-gstreamer-1.0.8-1.fc40.x86_64
pipewire-pulseaudio-1.0.8-1.fc40.x86_64
pipewire-jack-audio-connection-kit-1.0.8-1.fc40.x86_64
pipewire-alsa-1.0.8-1.fc40.x86_64
pipewire-utils-1.0.8-1.fc40.x86_64
pipewire-libs-extra-1.0.8-1.fc40.x86_64
pipewire-plugin-libcamera-1.0.8-1.fc40.x86_64
qemu-audio-pipewire-8.2.7-1.fc40.x86_64