# force discharge of battery in laptop with connected powersupply



## bzz (Nov 14, 2019)

Hello, is there a way to enforce (from command line) laptop to start discharging (using) the installed batter in laptop even if the laptop is connected to power supply? 

The whole idea is that i have old Lenovo T420 laptop, which i'm using as small home server. It has installed battery, which is still quite fit, however i would like to prevent bigger degradation of the battery to discharge it (without unplugging the power supply cord physically) and then let it recharge. 

Any ideas how to do that from command line?


----------



## T-Daemon (Nov 14, 2019)

Try `sysctl hw.acpi.acline=0` , it will only work if the hardware supports it. More info in acpi(4).


----------



## bzz (Nov 15, 2019)

T-Daemon said:


> Try `sysctl hw.acpi.acline=0` , it will only work if the hardware supports it. More info in acpi(4).




```
root@lenovo:~ # sysctl hw.acpi.acline=0
sysctl: oid 'hw.acpi.acline' is read only
```
 :-( thanks for suggestion, however seems that will not work :/


----------



## T-Daemon (Nov 15, 2019)

If that server is continuously running and if there is no software solution, maybe a hardware solution might be an option. An outlet timer would cut the power and turn it on in configured intervalls, and it does not requiere supervision.



			https://www.amazon.com/gp/aw/s/ref=is_s?k=outlet+timer
		




bzz said:


> (without unplugging the power supply cord physically)


Then maybe an outlet with an on/off switch?


----------



## obsigna (Nov 15, 2019)

bzz said:


> ... It has installed battery, which is still quite fit, however i would like to prevent bigger degradation of the battery to discharge it (without unplugging the power supply cord physically) and then let it recharge ...



Perhaps, I did not correctly understand your concern, about the aging behaviour of a connected battery, however, most batteries suffer less aging when being kept fully charged.

Almost all batteries die immediately upon total discharge. High capacity Li batteries of modern devices come with built-in controllers for keeping the battery in a save range of charge in order to optimize the service life. This means, most controllers do automagically what you are pretending to do, as long as they’re powered on. I leave my laptops always connected exactly for this reason, even when I am on travel I connect it to AC power whenever possible, even if the battery is fully charged.


----------



## mast07 (Nov 15, 2019)

If you do not fear applying patches and compile your own kernels you could try the patchset provided with https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=234403


----------



## SirDice (Nov 18, 2019)

T-Daemon said:


> If that server is continuously running and if there is no software solution, maybe a hardware solution might be an option.


I would simply remove the battery. Heat is pretty detrimental for a battery, even if you diligently charge cycle it.


----------



## abishai (Nov 18, 2019)

Lithium chemistry battery doesn't need discharge-charge cycle. Discharge it to 60 percent, unplug and keep in cool place (0 - 15C)


----------



## bzz (Nov 20, 2019)

Thanks all you guys for answers.



> Then maybe an outlet with an on/off switch?


Will try later Sonoff Smart Remote Control Wifi, which can be reflashed and you can put your own code 



> If you do not fear applying patches and compile your own kernels you could try the patchset provided with https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=234403https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=234403


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=234403
With custom kernel would be the best, however didn't applied patches yet. (just need to study it a bit how to apply them. build custom kernel otherwise is easy)



> Lithium chemistry battery doesn't need discharge-charge cycle. Discharge it to 60 percent, unplug and keep in cool place (0 - 15C)


Don't know about the chemistry at all. If it will be discharged to 60% and stored, will it really "survive time"? (i really don't know and never study/read about it)


----------



## CraigHB (Nov 25, 2019)

You don't want to cycle a Li-Ion battery if you don't have to since it puts wear on it.  There's no need to "condition" a Li-Ion battery in such a manner as you would the old NiCad types.  Even those have been supplanted by NiMH and some don't need any conditioning either.

Best way to store a Li-Ion battery is half charge in a cool environment, but that wouldn't be possible in a running machine.  You have two options.  Remove it and store it under ideal conditions or leave it in the machine at full charge where you'll take the big hit in shelf life due to higher temperatures and full state of charge.

Though I really wish there was a way to keep a Li-Ion battery at half charge in a running machine.  I have this really nice new laptop with a battery that's not easily replaceable.  It spends most of its time plugged-in to the wall and it bums me out I'm killing the battery shelf life for no reason.

You can find documentation on Li-Ion shelf life pretty easy with some Googling, but it's about 3 years at room temperature and full charge versus about 10 years at half charge and 0-10C.  State of charge makes more of a difference for room temperature and below.  Shelf life shortens quite a bit when stored in unusually high temperatures, like above 35C.

Maybe someday they'll come up with a battery that doesn't suffer from these things with energy density high as the Lithium Cobalt type of Li-Ion used in most devices.  Wouldn't that be nice.  Actually there is one Li-Ion type that's a lot more robust and that's LiFePO4, but energy density is considerably lower and that type is typically used only for industrial stuff.


----------



## Birdy (Nov 25, 2019)

bzz said:


> Don't know about the chemistry at all. If it will be discharged to 60% and stored, will it really "survive time"? (i really don't know and never study/read about it)








						Battery Information Table of Contents, Basic to Advanced
					

Learn about battery technology, battery maintenance and battery life at Battery University



					batteryuniversity.com


----------

