actuallymentor / battery

CLI for managing the battery charging status for M1 Macs
MIT License
3.19k stars 139 forks source link

enable smc charging not possible. #282

Open thiccasss opened 3 weeks ago

thiccasss commented 3 weeks ago

After I disable battery limit it won't charge anymore and smc charging is still disabled. If I write "battery charging on" in terminal, it still won't turn on and charge. Only way is to reset smc by restart the Mac.

how can I turn on smc charging again without restarting the Mac anytime?

Bildschirmfoto 2024-06-13 um 11 27 45
mindok commented 3 weeks ago

I had to uninstall to get charging past 80% going again. When using the CLI to try and turn on charging, I was getting the following output - I suspect the error of interest is Error: SMCWriteKey() = e00002bc:

battery charging on

06/15/24-16:38:22 - Setting charging to on
06/15/24-16:38:22 - Killing running maintain daemons & enabling charging as default state
06/15/24-16:38:22 - Disabling daemon at gui/501/com.battery.app
06/15/24-16:38:22 - πŸ”ŒπŸ”‹ Enabling battery charging
06/15/24-16:38:22 - πŸ”ΌπŸͺ« Disabling battery discharging
06/15/24-16:38:22 - Charge above stop
06/15/24-16:38:22 - πŸ”ŒπŸͺ« Disabling battery charging
06/15/24-16:38:22 - πŸ’‘ Setting magsafe color to green
Error: SMCWriteKey() = e00002bc
06/15/24-16:38:22 - πŸ’‘ Setting magsafe color to
Error: SMCWriteKey() = e00002bc
06/15/24-16:38:22 - Battery at 81% (attached; remaining), smc charging disabled
06/15/24-16:38:22 - πŸ”ŒπŸ”‹ Enabling battery charging
06/15/24-16:38:22 - πŸ”ΌπŸͺ« Disabling battery discharging
06/15/24-16:38:22 - Charge above on
06/15/24-16:38:22 - πŸ”ŒπŸͺ« Disabling battery charging
06/15/24-16:38:22 - πŸ’‘ Setting magsafe color to green
Error: SMCWriteKey() = e00002bc

I'm on a MacBook 13" M1 2020, macOS version 14.5. It broke on macOS version upgrade, but I can't recall which one as I haven't travelled for quite a few months.

adamlounds commented 1 week ago

I had the same issue. Not sure why, but the enable_charging function disables charging again Β―\_(ツ)_/Β―

https://github.com/actuallymentor/battery/blob/481610ac05a6fedefb36d43032705cd9136f4691/battery.sh#L185

function enable_charging() {
    log "πŸ”ŒπŸ”‹ Enabling battery charging"
    sudo smc -k CH0B -w 00
    sudo smc -k CH0C -w 00
    disable_discharging
}

To re-enable normal charging behaviour, try

battery maintain stop
sudo smc -k CH0B -w 00
sudo smc -k CH0C -w 00