MichalW / gnome-bluetooth-battery-indicator

Gnome-Shell extension displaying battery percentage for bluetooth devices
GNU General Public License v3.0
119 stars 39 forks source link

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

Open RogerGodzilla opened 3 years ago

RogerGodzilla commented 3 years ago

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 commented 3 years ago

Update: rebooting had no effect

MichalW commented 3 years ago

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.

ghost commented 3 years ago

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

ayushdiagarwal commented 3 years ago

+1 I have the same error.

oesst commented 3 years ago

+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')

sesse commented 3 years ago

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).

tchicotti commented 2 years ago

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

darkdragon-001 commented 2 years ago

Same problem in Fedora 34.

guiNovais commented 2 years ago

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.

JadeVane commented 2 years ago

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

hey-xico commented 2 years ago

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

tborowy commented 2 years ago

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
malomehi commented 2 years ago

Same error with Powerbeats Pro

Debian GNU/Linux bookworm/sid Gnome 41.0

MichalW commented 2 years ago

@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"

tborowy commented 2 years ago

@MichalW For me bluetoothctl info don't work.

alexfornuto commented 2 years ago

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
coldtobi commented 2 years ago

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...

scr4bble commented 2 years ago

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:

kauanmocelin commented 2 years ago

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

MichalW commented 2 years ago

@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

alexfornuto commented 2 years ago

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 bluetooth-battery@michalw.github.com: 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
MichalW commented 2 years ago

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

alexfornuto commented 2 years ago

Not even a full reboot resolves.

JadeVane commented 2 years ago

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/bluetooth-battery@michalw.github.com/utils.js:53:26
ismasou commented 2 years ago

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

Biasio commented 2 years ago

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

edggoncalves commented 2 years ago

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

kred-jon commented 2 years ago

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

JadeVane commented 2 years ago

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