Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current limit depends on macOS charging percentage, which is not accurate. #294

Open
js4jiang5 opened this issue Jul 23, 2024 · 11 comments
Open

Comments

@js4jiang5
Copy link

What is the issue? (required)
Current limit depends on macOS charging percentage, which differs from real hardware charging percentage by 1~7%.

What exactly did you do to produce the issue? (required)
I recorded the charging percentages of macOS and CoconutBattery.
I set "battery maintain 65".
When macOS dropped to 64% and triggered charging, CoconutBattery shows 60.1%. The difference is about 4%.
After battery is charged to macOS 66%, CoconutBattery shows 65.1%. The difference is about 1%.
The difference varies, depending on whether it's charging or discharging.

Expected behavior (required)
As Al dente pointed out that they use real hardware charging percentage instead of macOS percentage, it would be better for battery.app to do the same for better accuracy.

Additional context (optional)
I tried to use voltage to remedy this issue, but found that even using voltage has problems.
For example, if you set "battery maintain 11.4V 0.2V", you expect it to trigger charging at 11.2V and stop charging at 11.6V.
However, in reality, when the charging is triggered at 11.2V, it abruptly jumped to 12.2V due to charging.

@js4jiang5
Copy link
Author

Since no one responded, I spent some time to solve it by myself by modifying battery.sh. The modifications include

  1. replace macOS battery percentage with real hardware charging percentage.
  2. add sail mode with command "battery maintain 60 50", which stop charging when exceeding 60% and start charging when less than 50%
  3. modify "battery callibrate" to discharge to maintain percentage instead of 80%
    It's running well. Now the modified version is exactly what I needed. Bingo!

@mihten
Copy link

mihten commented Sep 1, 2024

Since no one responded, I spent some time to solve it by myself by modifying battery.sh. The modifications include

  1. replace macOS battery percentage with real hardware charging percentage.
  2. add sail mode with command "battery maintain 60 50", which stop charging when exceeding 60% and start charging when less than 50%
  3. modify "battery callibrate" to discharge to maintain percentage instead of 80%
    It's running well. Now the modified version is exactly what I needed. Bingo!

Can you please share your modified version?

@peteygao
Copy link

peteygao commented Sep 2, 2024

@js4jiang5 Care to create a PR with your changes?

@js4jiang5
Copy link
Author

@js4jiang5 Care to create a PR with your changes?

I don't know how to PR, but I just checked current PR and found someone has been working on similar issue.

@mihten
Copy link

mihten commented Sep 2, 2024

@js4jiang5 Care to create a PR with your changes?

I don't know how to PR, but I just checked current PR and found someone has been working on similar issue.

Tried that, doesn’t work as expected.
Now we depend on you

@js4jiang5
Copy link
Author

@js4jiang5 Care to create a PR with your changes?

I don't know how to PR, but I just checked current PR and found someone has been working on similar issue.

Tried that, doesn’t work as expected. Now we depend on you

Could you describe what went wrong?

@mihten
Copy link

mihten commented Sep 3, 2024

@js4jiang5 Care to create a PR with your changes?

I don't know how to PR, but I just checked current PR and found someone has been working on similar issue.

Tried that, doesn’t work as expected. Now we depend on you

Could you describe what went wrong?

Correction - it didn't work at all, if we talk about the same PR from user seefood. I don't remember the details, if you really need that info I could try again sometime this week.

@js4jiang5
Copy link
Author

@js4jiang5 Care to create a PR with your changes?

I don't know how to PR, but I just checked current PR and found someone has been working on similar issue.

Tried that, doesn’t work as expected. Now we depend on you

Could you describe what went wrong?

Correction - it didn't work at all, if we talk about the same PR from user seefood. I don't remember the details, if you really need that info I could try again sometime this week.

Yep, the PR from seefood. Please try again and let us know.

@mihten
Copy link

mihten commented Sep 14, 2024

@js4jiang5
Finally found some time, this is the output:

% battery maintain 70-80
touch: /Users/USER/.battery/battery.log: Permission denied
/usr/local/bin/battery: line 935: syntax error: unexpected end of file

@mihten
Copy link

mihten commented Sep 21, 2024

I actually managed to use the solution from seefood, but adding his code manually to current battery.sh version. I lost some functionalities on the way (like maintain voltage), just for the sake of easier debugging, I don't even need it.
All in all, it's been working for the last week, maintaining percentage between 70 and 80%.

Maybe I'll try to merge them in a clean way, but I would like to see your solution too @js4jiang5

@js4jiang5
Copy link
Author

js4jiang5 commented Oct 19, 2024

Don't use their calibrate. It might be detrimental to the battery.
My battery health in coconutBattery app showed 100.2% when I purchased it in July this year.
image

After first use of calibrate, it dropped to 99.2%. I was kind of disappointed.
After 2nd use of calilbrate, it further dropped to 95.9%. I was totally shocked.
image
image

The reason I tried this battery app is because AlDente has two extreme comments on Reddit. One group of people praised it while the other group complained that their battery health dropped immedately at first use of AlDente.

I can't believe it also happened to me even with this battery app.
So I decided to fork it and develop my own version. Rewrite the calibrate function with integration of power control directly using smart home outlet switch.
Thank God. The battery health was back to 97.8% after first use of my own version, and even further improved back to 100.6% after 2nd use.
image
image

Still need to do more experiments to clarify something, though. I am always wondering what happened to AlDente that results in two extreme comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants