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

Voltage limit #224

Merged
merged 5 commits into from
Jun 28, 2024
Merged

Voltage limit #224

merged 5 commits into from
Jun 28, 2024

Conversation

rguca
Copy link
Contributor

@rguca rguca commented Jan 17, 2024

This is a draft for the feature request in #214.

Output:

./battery.sh voltage 11.55 11.7 
01/17/24-19:47:18 - Keeping voltage between 11.55V and 11.7V
01/17/24-19:47:18 - Battery at 11.55V
01/17/24-19:48:18 - Battery at 11.551V
01/17/24-19:49:18 - Battery at 11.549V
01/17/24-19:49:18 - 🔌🔋 Enabling battery charging
01/17/24-19:49:18 - 🔼🪫 Disabling battery discharging
01/17/24-19:50:18 - Battery at 11.688V
01/17/24-19:51:19 - Battery at 11.704V
01/17/24-19:51:19 - 🔌🪫 Disabling battery charging
01/17/24-19:52:19 - Battery at 11.587V
01/17/24-19:53:19 - Battery at 11.569V
01/17/24-19:54:19 - Battery at 11.566V

@djbob2000
Copy link

I think keeping the battery at a certain Voltage (usually after 4 Volts degradation starts, and 3.7 is recommended for long life) is a good idea. I would definitely like to see this feature in the program. Another question is how well it works, have you tested it?

@rguca
Copy link
Contributor Author

rguca commented Mar 16, 2024

I use battery.sh voltage 11.3 11.4 as login item since one month instead of the percentage limit and I am very pleased with it. The battery is kept at 11.4V which is 3.8V per cell. Virtually no self discharge at this state of charge.

A more user friendly approach would be to integrate this into the daemon so no login item has to be created for autostart manually.

@djbob2000
Copy link

I'm not quite sure what to do with the file. Could you please tell me in detail what you need to do step by step to use the voltage limitation?

@djbob2000
Copy link

Got it. I set battery voltage 11.1 11.4. This kept the battery within 60-72%. I like it:)

@actuallymentor
Copy link
Owner

This is a very cool idea @rguca!

Could I ask you to edit it so that the voltage section functions the same as the maintain one? From the top of my head this would probably require:

  1. Renaming the action maintain_voltage_synchronous
  2. Adding a voltage based handling of the maintain command, perhaps my setting 1.1v like syntax?
  3. Run through the maintain daemon to make sure everything is logically consistent

This would make your work compatible for all users in the same was as the current commands are.

@rguca
Copy link
Contributor Author

rguca commented Mar 23, 2024

I also suggest adding a second optional argument to the maintain command, to set the voltage where charging should start again.

For my use case it would be then:
battery maintain 11.4v 11.3v

and for @djbob2000 it would be:
battery maintain 11.4v 11.1v

Specifying a range like that would probably be better for the charging circuit, because it doesn't have to switch on and off as often.

@rguca
Copy link
Contributor Author

rguca commented Jun 20, 2024

The syntax is now:
battery maintain 11.4V
This keeps the battery between 11.3V and 11.5V.

Also optional with hysteresis:
battery maintain 11.4V 0.5V
This keeps the battery between 10.9V and 11.9V.

I tried to make the changes as close as possible to your request @actuallymentor

@actuallymentor actuallymentor merged commit 35d6e1c into actuallymentor:main Jun 28, 2024
@actuallymentor
Copy link
Owner

This is an extremely cool PR @rguca, I've merged it. Please keep a close eye on the issue tab the coming weeks just in case this accidentally broke anything!

@neoeleatic
Copy link

neoeleatic commented Jun 28, 2024

Parts of this pull request got apparently rewritten in a subsequent merge, resulting in this feature not working in https://github.com/actuallymentor/battery/releases/tag/v1.2.2

@actuallymentor
Copy link
Owner

Ah dammit. The merge conflicts must have bit me...

@rguca could I ask you for a new PR with a fix for the broken merge?

@rguca rguca mentioned this pull request Jun 30, 2024
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

Successfully merging this pull request may close these issues.

4 participants