Closed da-the-dev closed 1 year ago
Disconnect your device, then run the script.
Ok, I did disconnect the device and just have it nearby, now when I run the script I get this
Traceback (most recent call last):
File "<string>", line 3, in send
_bluetooth.error: (14, 'Bad address')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/sv-cheats-1/Git-installed apps/Bluetooth_Headset_Battery_Level/./bluetooth_battery.py", line 166, in <module>
main()
File "/home/sv-cheats-1/Git-installed apps/Bluetooth_Headset_Battery_Level/./bluetooth_battery.py", line 163, in main
print("Battery level for {} is {}".format(device, str(query)))
^^^^^^^^^^
File "/home/sv-cheats-1/Git-installed apps/Bluetooth_Headset_Battery_Level/./bluetooth_battery.py", line 93, in __str__
return "{:.0%}".format(self._perform_query() / 100)
^^^^^^^^^^^^^^^^^^^^^
File "/home/sv-cheats-1/Git-installed apps/Bluetooth_Headset_Battery_Level/./bluetooth_battery.py", line 105, in _perform_query
sock.send(b"+BRSF: 1024")
File "/home/sv-cheats-1/Git-installed apps/Bluetooth_Headset_Battery_Level/./bluetooth_battery.py", line 66, in send
return super().send(b"\r\n" + data + b"\r\n")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<string>", line 5, in send
bluetooth.btcommon.BluetoothError: [Errno 14] Bad address
I took the MAC address from Blueman. I'm trying to read the battery level of my Airpods Pro 2, if that helps.
This code does not support AirPods or any headphones with a custom/proprietary protocol. You can check out other projects that are written specifically for AirPods:
https://github.com/faglo/AirStatus https://github.com/delphiki/gnome-airpods-battery-status https://github.com/SpriteOvO/AirPodsDesktop
I've cloned the repo and ran the script, but it crashes with this error
What is this error and how to resolve it?