macchina icon indicating copy to clipboard operation
macchina copied to clipboard

Wrong battery value on MacOS

Open b1nhack opened this issue 1 year ago • 10 comments

The macchina battery percentage value doesn't match the MacOS system's (about 3 less)

b1nhack avatar Jan 12 '24 21:01 b1nhack

It would help if you provided your macOS, macchina and libmacchina versions.

grtcdr avatar Jan 13 '24 19:01 grtcdr

MacOS Sonoma 14.2.1 macchina 6.1.8 libmacchina 6.3.5

b1nhack avatar Jan 14 '24 07:01 b1nhack

Can anyone with Apple hardware confirm this? If so, please let us know by contributing to the conversation.

grtcdr avatar Feb 01 '24 15:02 grtcdr

I see this issue with the battery too. Let me know if I can help debug the issue.

# native macOS tool
$ pmset -g batt
Now drawing from 'Battery Power'
 -InternalBattery-0 (id=33816675)	93%; discharging; 16:46 remaining present: true
# macchina
Battery     -  88% & Discharging

mikemadden42 avatar May 01 '24 10:05 mikemadden42

Third-party battery replacements have caused issues, though way more sinister than this, in the past ^1. Are these miscalculations occuring on machines with an authentic battery?

grtcdr avatar May 04 '24 13:05 grtcdr

Yes! My machine is brand new, from the Apple store.

b1nhack avatar May 04 '24 14:05 b1nhack

My MacBook also has the factory installed battery. Utils like pmset -g batt seem accurate while the calculation with macchina seem off.

mikemadden42 avatar May 04 '24 15:05 mikemadden42

I'll defer this to @123marvin123 as he knows more about the macOS side of things than I do.

grtcdr avatar May 04 '24 20:05 grtcdr

I'm not sure what could be the reason for these larger differences between the "pmset -g batt" command and macchinas readout. For macchina, the values are coming directly from IOKit. Only minor floating point -> int conversion are expected.

This is what I get on my MacBook Air M1 with original battery:

pmset -g batt
Now drawing from 'Battery Power'
 -InternalBattery-0 (id=22282339)	71%; discharging; 4:17 remaining present: true
Battery     -  70% & Discharging

123marvin123 avatar May 04 '24 21:05 123marvin123