TheWeirdDev / Bluetooth_Headset_Battery_Level

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

Inconsistent values #5

Closed keystroke3 closed 4 years ago

keystroke3 commented 4 years ago

I am trying to turn the script to a Polybar module so that I can have the battery information there. I have been successful in getting the values, and have made a few changes so that it shows an icon instead of just the level. Problem is, the values are not consistent. When I run this, it keeps flipping between two values e.g. 70 and 80%. I do not fully understand how the script works, so a little elaboration may help me understand.

TheWeirdDev commented 4 years ago

That is pretty normal. Bluetooth headsets send the battery level in multiples of 10, for example if the actual level is 73% it might say it is 70 or 80. That's why it's not accurate sometime and gives different values. It's better not to run the script too often and let the battery level change over a period of time to get a better result.

keystroke3 commented 4 years ago

Ah, I see. I made a change in the script that makes it check every 5 min. In the version I showed you, I was testing it in a shell loop that cycled pretty fast. In it, it kept flipping so fast I thought it was a bug. Thanks anyway. You might consider submitting the script to Polybar-scripts. I can do a pull request if you like.

TheWeirdDev commented 4 years ago

No problem. You can submit your fork. This one is just suitable for command line users.