TheWeirdDev / Bluetooth_Headset_Battery_Level

A python script to get battery level from Bluetooth headsets
GNU General Public License v3.0
766 stars 80 forks source link

Not working for AirPods #97

Open plushrib opened 3 months ago

plushrib commented 3 months ago

I tried refreshing, didn't work

it either returned:

Traceback (most recent call last): File "/sbin/bluetooth_battery", line 8, in <module> sys.exit(main()) ^^^^^^ File "/usr/lib/python3.12/site-packages/bluetooth_battery/bluetooth_battery.py", line 163, in main print("Battery level for {} is {}".format(device, str(query))) ^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/bluetooth_battery/bluetooth_battery.py", line 93, in __str__ return "{:.0%}".format(self._perform_query() / 100) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/bluetooth_battery/bluetooth_battery.py", line 101, in _perform_query sock.connect(self._bt_settings) File "<string>", line 5, in connect bluetooth.btcommon.BluetoothError: [Errno 111] Connection refused

or nothing at all

I tried the port trick, didn't work

bluetooth_battery AA:BB:CC:DD:EE:FF.2
Traceback (most recent call last):
  File "<string>", line 3, in connect
_bluetooth.error: (111, 'Connection refused')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/sbin/bluetooth_battery", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.12/site-packages/bluetooth_battery/bluetooth_battery.py", line 163, in main
    print("Battery level for {} is {}".format(device, str(query)))
                                                      ^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/bluetooth_battery/bluetooth_battery.py", line 93, in __str__
    return "{:.0%}".format(self._perform_query() / 100)
                           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/bluetooth_battery/bluetooth_battery.py", line 101, in _perform_query
    sock.connect(self._bt_settings)
  File "<string>", line 5, in connect
bluetooth.btcommon.BluetoothError: [Errno 111] Connection refused