beltex / SystemKit

macOS system library in Swift
MIT License
351 stars 65 forks source link

Not showing correct battery charge #22

Open pkrll opened 8 years ago

pkrll commented 8 years ago

I don't know if this is a bug or just me. But using the Battery method charge() doesn't seem to return the correct charge. It's about 5-6 percents lower than what it should be.

screen shot 2016-06-29 at 23 27 47 screen shot 2016-06-29 at 23 28 45

beltex commented 7 years ago

Hello @pkrll!

Sorry about the late response on this!

Few possibilities:

Could cross check with Apple's own tool via, pmset -g batt

arjndr commented 6 years ago

2 years later and can confirm this on macOS Mojave image image

EDIT : This seems to be an issue with the IOKit library

pmset -g batt returns the battery percentage displayed on the menubar but when I convert the output from ioreg -w0 -l | grep Capacity command, which I think uses the IOKit library, the battery percentage is off by 3-6%

EDIT 2 : Ok this is interesting, pmset -g rawlog shows incorrect battery percentage too, but pmset -g batt does not, I don't even know which one is incorrect anymore lol