gnome-bluetooth-battery-indicator icon indicating copy to clipboard operation
gnome-bluetooth-battery-indicator copied to clipboard

No percentage is displayed, only the string "refused')"

Open RogerGodzilla opened this issue 4 years ago • 29 comments

I currently have this plugin installed, but can't seem to get it to work. I have installed the required dependencies for Ubuntu 20.04 (which I am running). The settings menu seems to be functioning, and the icon shows up properly, but the percentage does not appear, instead being replaced by the string "refused')" without quotes. I will try a restart and update this issue after doing so. Image

RogerGodzilla avatar Apr 22 '21 01:04 RogerGodzilla

Update: rebooting had no effect

RogerGodzilla avatar Apr 22 '21 01:04 RogerGodzilla

What device are you connecting?

This script is based on another one: https://github.com/TheWeirdDev/Bluetooth_Headset_Battery_Level

Try to run the script bluetooth_battery.py from the above package manually.

MichalW avatar Apr 22 '21 07:04 MichalW

I had the same error, I clicked the icon and selected 'Refresh'. Haven't had any issues since.

ghost avatar May 06 '21 02:05 ghost

+1 I have the same error.

ayushdiagarwal avatar May 06 '21 05:05 ayushdiagarwal

+1 Same error with a Bose quietcomfort 35.

The command journalctl -f -o cat /usr/bin/gnome-shell prints out:

Bluetooth battery indicator: 28:11:XXXXXX is offline (16, 'Device or resource busy') Bluetooth` battery indicator: 28:11:XXXXXXis offline (111, 'Connection refused')

oesst avatar May 07 '21 06:05 oesst

I fixed QC35 (and potentially others) in the Bluetooth_Headset_Battery_Level repository, so the submodule needs to be updated (and a new release made).

sesse avatar May 17 '21 08:05 sesse

+1 same error, I give a try in TheWeirdDev but same happens.

tchicotti avatar Sep 13 '21 18:09 tchicotti

Same problem in Fedora 34.

darkdragon-001 avatar Sep 14 '21 08:09 darkdragon-001

I am using a Ubuntu 21.04 in a ASUS S451LA and the headphone is a Pulse PH274. Same thing happens here, aldough it does not display the last characters, just the refuesd string.

guiNovais avatar Oct 04 '21 16:10 guiNovais

same here, using Sony WH-1000XM4 with ubuntu 20.04.

JadeVane avatar Oct 07 '21 08:10 JadeVane

Having the same issue with Sony WH-1000XM4 and Logitec Mx Master 3 on Pop!_OS 21.04

hey-xico avatar Oct 21 '21 17:10 hey-xico

same here, Headset: Sennheiser HD4.40 BT OS: Ubuntu 21.10 Gnome: 40.4.0 bluetoothd: 5.60

Relust from journalctl -f -o cat /usr/bin/gnome-shell

Bluetooth battery indicator: 00:16:94:3A:16:6F is offline [Errno 111] Connection refused

tborowy avatar Oct 27 '21 08:10 tborowy

Same error with Powerbeats Pro

Debian GNU/Linux bookworm/sid Gnome 41.0

malomehi avatar Oct 31 '21 10:10 malomehi

@tchicotti @tborowy @malomehi

In the new version, we have new settings: "Get Battery levels using bluetoothctl". You can try to enable it If you see percentages after using the command: "bluetoothctl info"

MichalW avatar Nov 03 '21 14:11 MichalW

@MichalW For me bluetoothctl info don't work.

tborowy avatar Dec 01 '21 10:12 tborowy

Device:Bose Soundlink AE II OS: Pop!_OS 20.04 LTS Not using bluetoothctl: "Refused"

❯ ./tmp/bluetooth_battery.sh
Traceback (most recent call last):
  File "/home/alex/./tmp/bluetooth_battery.sh", line 12, in <module>
    import bluetooth
ModuleNotFoundError: No module named 'bluetooth'
❯ which python
/usr/bin/python
❯ sudo apt install python3-bluez
[sudo] password for alex: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-bluez is already the newest version (0.22+really0.22-1build2).
0 upgraded, 0 newly installed, 0 to remove and 23 not upgraded.
❯ pip3 install pybluez
Requirement already satisfied: pybluez in /usr/local/lib/python3.8/dist-packages (0.23)

Using bluetoothctl: "?"

❯ ./tmp/bluetoothctl_battery.sh
?
journalctl -f -o cat /usr/bin/gnome-shell
../clutter/clutter/clutter-actor.c:10558: The clutter_actor_set_allocation() function can only be called from within the implementation of the ClutterActor::allocate() virtual function.
Bluetooth battery indicator: ?

../clutter/clutter/clutter-actor.c:10558: The clutter_actor_set_allocation() function can only be called from within the implementation of the ClutterActor::allocate() virtual function.
Bluetooth battery indicator: 08:DF:1F:52:DF:47 is offline [Errno 111] Connection refused

../clutter/clutter/clutter-actor.c:10558: The clutter_actor_set_allocation() function can only be called from within the implementation of the ClutterActor::allocate() virtual function.
Bluetooth battery indicator: ?

Bluetooth battery indicator: ?

Received error from D-Bus search provider indicator-sensors.desktop: Gio.DBusError: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name com.github.alexmurray.IndicatorSensors was not provided by any .service files
Received error from D-Bus search provider indicator-sensors.desktop: Gio.DBusError: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name com.github.alexmurray.IndicatorSensors was not provided by any .service files
Received error from D-Bus search provider indicator-sensors.desktop: Gio.DBusError: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name com.github.alexmurray.IndicatorSensors was not provided by any .service files

alexfornuto avatar Dec 29 '21 17:12 alexfornuto

Just an idea into a complete different direction: Gnome exports the battery values using DBus ... (https://upower.freedesktop.org/docs/UPower.html), so the parsing / enumerating could be offloaded to Gnome to reduce complexity...

coldtobi avatar Jan 03 '22 09:01 coldtobi

Same here: Fedora 34, Headset Steelseries Arctis 9, GNOME Shell 40.7 Dependencies installed using DNF according README in this project in addition to enabling the extension in Gnome.

Instead of percentage value:

  • "refused" (even after refreshing) when using bluetoothctl is set to off
  • "?" when using bluetoothctl option from extension settings (option set to on)

scr4bble avatar Jan 07 '22 14:01 scr4bble

Same problem here: "refused" or "?" on bluetoothctl mode. Headphone JBL Duet NC.

kauanmocelin avatar Feb 16 '22 18:02 kauanmocelin

@RogerGodzilla @Crucizer @oesst @tchicotti @darkdragon-001 @guiAlberto @JadeVane @xicoalmeida @tborowy @malomehi @kauanmocelin

I have uploaded a new version of this package. After updating, if you get a "refused" message, please try to use the "Force Refresh" button.

The button disconnects the device to retrieve battery information and connects the device again.

For some reason, you only need to do this once and the later battery indicator works as normal

MichalW avatar Mar 19 '22 18:03 MichalW

The updated version will not load. I wish I could give you more details, but all Gnome will say is "Error loading extension".

EDIT: here are some o 'dem deets

❯ journalctl -f -o cat /usr/bin/gnome-shell
Received error from D-Bus search provider indicator-sensors.desktop: Gio.DBusError: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name com.github.alexmurray.IndicatorSensors was not provided by any .service files
Received error from D-Bus search provider io.elementary.appcenter.desktop: Gio.DBusError: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name io.elementary.appcenter was not provided by any .service files
Received error from D-Bus search provider indicator-sensors.desktop: Gio.DBusError: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name com.github.alexmurray.IndicatorSensors was not provided by any .service files
Received error from D-Bus search provider io.elementary.appcenter.desktop: Gio.DBusError: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name io.elementary.appcenter was not provided by any .service files
Received error from D-Bus search provider org.gnome.seahorse.Application.desktop during GetResultMetas: Gio.DBusError: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.gnome.Shell.SearchProvider2” on object at path /org/gnome/seahorse/Application
Wrong number of result metas returned by search provider org.gnome.seahorse.Application.desktop: expected 1 but got 0
JS WARNING: [resource:///org/gnome/shell/ui/extensionSystem.js 375]: reference to undefined property "version"
JS ERROR: Extension [email protected]: Error: A different version was loaded previously. You need to log out for changes to take effect.
loadExtension@resource:///org/gnome/shell/ui/extensionSystem.js:341:52

alexfornuto avatar Mar 21 '22 13:03 alexfornuto

@alexfornuto Thanks for the information. In the meantime, please try "alt + F2" and type "r" and enter

MichalW avatar Mar 21 '22 14:03 MichalW

Not even a full reboot resolves.

alexfornuto avatar Mar 21 '22 14:03 alexfornuto

I get "refused" again, some log from journalctl -f -o cat /usr/bin/gnome-shell here

[bluetooth-battery-indicator] Using percentage source 'python-script' for device 'WH-1000XM4' (14:3F:A6:A4:85:AC).
clutter_actor_add_child: assertion 'child->priv->parent == NULL' failed
[bluetooth-battery-indicator] Percentage from script: ok

clutter_actor_add_child: assertion 'child->priv->parent == NULL' failed
[bluetooth-battery-indicator] Using percentage source 'python-script' for device 'WH-1000XM4' (14:3F:A6:A4:85:AC).
[bluetooth-battery-indicator] Percentage from script: 14:3F:A6:A4:85:AC is offline [Errno 16] Device or resource busy

[bluetooth-battery-indicator] Percentage from script: 14:3F:A6:A4:85:AC is offline [Errno 111] Connection refused

[bluetooth-battery-indicator] Percentage from script: ok

JS ERROR: TypeError: onSuccess is not a function
runPythonScript/<@/home/wenjinyu/.local/share/gnome-shell/extensions/[email protected]/utils.js:53:26

JadeVane avatar Mar 22 '22 01:03 JadeVane

For me, I was able to make it work using Upower after I enabled experimental features: https://wiki.archlinux.org/title/bluetooth_headset#Battery_level_reporting

ismasou avatar Jun 11 '22 20:06 ismasou

For me, I was able to make it work using Upower after I enabled experimental features: https://wiki.archlinux.org/title/bluetooth_headset#Battery_level_reporting

Also for me enabling experimental features works fine with upower. Thanks! Bose quietcomfort 35 II PopOS! 22.04

Biasio avatar Jul 09 '22 10:07 Biasio

Still getting ? with Upower and bluetoothctl, Connection refused with the python script, with my XM4, on an Ubuntu 20.04.

edggoncalves avatar Aug 24 '22 13:08 edggoncalves

just change the Upower script as here: https://github.com/MichalW/gnome-bluetooth-battery-indicator/issues/44#issuecomment-1233842251

kred-jon avatar Sep 01 '22 07:09 kred-jon

This may not be a bluetooth battery issue, try running bluetooth info and you may not find any power related data in the results.

Since bluez does not show the battery level of bluetooth devices by default, but it has an experimental feature that supports battery queries and must be enabled manually, try running the following command

sudo sed -i '/[General]/a\Experimental=true' /etc/bluetooth/main.conf
sudo systemctl restart bluetooth

At this point the bluetooth device will be disconnected, just reconnect it manually

Then enable the upower method of querying in the settings and you will see the battery info in the panel

JadeVane avatar Sep 07 '22 06:09 JadeVane