zackelia / bclm

macOS command-line utility to limit max battery charge
MIT License
1.88k stars 92 forks source link

Apple Silicon macOS Ventura - persist seems to be misbehaving #33

Closed seamusdemora closed 9 months ago

seamusdemora commented 10 months ago

I've "installed" via the sudo cp bclm /usr/local/bin method. I've set the charge level: sudo bclm write 80 I've confirmed the charge level: bclm read ==> 80 I've set persistence: sudo bclm persist I've confirmed (using LaunchControl) that the com.zackelia.bclm.plist is loaded & running: /usr/local/bin/bclm write 80 I disabled Apple's native "Optimized Battery Charging" before installing bclm (REF #32 )

Earlier tonight, I had to remove my Mac from the charger for a while in the lab. The charge level had declined to 77% during that time. When I plugged the charger in again, I expected it to charge up to 80% - but it did not do this. Instead, hours later, it is still sitting at 77%.

Is this the expected behavior? What should I do to return the "persistence" to the set value of 80%??


UPDATE/FWIW: I've discovered that following a Restart, the bclm-controlled battery charging to the 80% level is resumed.

You're missing something here, dude.

zackelia commented 9 months ago

Not seeing this issue on my hardware. On Apple Silicon, bclm either writes 80 or 100 to the CHWA key and the firmware takes it from there. Not sure how I'm missing something.

seamusdemora commented 9 months ago

Closed as completed ?!

Close it if you like - it's your repo & your product. But FWIW I think I said the value of 80 was written in the plist. However, it's not the charge value displayed in the menu bar. And following a reboot, the value in the menu bar gradually comes back to 80%.

FWIW: My Mac is Model 14,6, Chip: Apple M2 Max, System Firmware Version: 10151.61.4, and I am running Ventura, macOS 13.6.3.

And when I say, "You're missing something" that is only meant that there is something else going on that your software hasn't accounted for. I didn't mean this as insulting or controversial - it's just a statement of fact. I don't know which indicator is correct - the menu bar or the plist. But they damn sure don't match.

lslqtz commented 8 months ago

From a technical point of view, on Apple Silicon, the program is only responsible for writing the CHWA value, and the specific charging logic is determined by Apple firmware.

This SMC key is used for Apple's Optimized Battery Charging, so if this issue occurs, then I speculate that there is only one possibility: Apple designed this value to be used with a loop check or a program that triggers periodically.

Obviously, the program was not designed to do this, so it's not the program's fault, nor Apple's.

Of course, maybe a workaround can be implemented, but it still needs to be observed what exactly is causing the problem

seamusdemora commented 8 months ago

From a technical point of view, on Apple Silicon, the program is only responsible for writing the CHWA value, and the specific charging logic is determined by Apple firmware.

Oh good grief... the program is responsible for "working" - or at least behaving rationally. Unfortunately, bclm does neither. So - make your excuses, put a very fine point on it - but don't start making up s**t about what the program is responsible for.

18Song commented 8 months ago

@seamusdemora I'm in a similar situation, but I didn't turn off "Optimized Battery Charging" and I didn't restart, I just unplugged it at night when I was resting, and it's gone from 80 to 77 in the last three days, with no sign of charging upwards!

Sonoma 14.4 M3 max

18Song commented 8 months ago

@seamusdemora 74,started charging. image

18Song commented 8 months ago

@seamusdemora https://support.apple.com/en-us/108055#:~:text=About%2080%25%20Limit%20with%20iPhone%2015%20models Referring to iphone's charging strategy, I think mac's charging strategy is the same as iphone's. And, on iphone, optimized battery charging and charging to 80% is an either/or, so it makes more sense to turn off optimized battery charging on mac after setting the threshold to 80 using bclm.