Page 1 of 1
Stop charging by software
Posted: 27 Jul 2016 07:52
by bichlepa
I always left my phone charging the whole night. It's well known that it is bad for the battery if it is fully charged and is kept fully charged for a long time.
I think it will improve battery life if it stops charging as soon it reaches 95%.
So I'd like to build a flow which stops charging as soon the battery is charged by 95%.
Is it possible that AutoMagic disconnects the charger by a software command? My phone is rooted.
Re: Stop charging by software
Posted: 27 Jul 2016 08:12
by Bushmills
I'm doing exactly that, but keeping charge between 60 and 70 percent. Two hours before scheduled or estimated depart I'll top up to 100%
Power supply is turned on or off with a GemBird / energenie sispm2 "power manager", connected to my internet router. The device runs under openwrt, and provides the sispmctl program which is used to control power rail functionality. Actually, 4 of those power rails are connected to the device.
On the router runs also a system called "serafena" (
https://github.com/Bushmills/serafena)
which, among other, receives power switching requests from the mobile devices, and switches the sockets accordingly.
Under
https://github.com/Bushmills/serafena/w ... wer-strips is an example of the resulting charge graph.
Re: Stop charging by software
Posted: 28 Jul 2016 18:36
by Martin
There are commands meant to be used for developers to test battery features. Maybe this can work for your use case.
Check out the dumpsys command. Here's the output from a Nexus 5X on Android 6:
Code: Select all
> dumpsys battery --help
Dump current battery state, or:
set [ac|usb|wireless|status|level|invalid] <value>
unplug
reset
dumpsys battery unplug would simulate unplugging the device.
dumpsys battery reset can be used to go back to normal operation.
You can execute the commands using action
Execute Root Command.
I'm not sure if this just fakes a few internal software toggles or if it actually stops charging the device. Let me know if it works.
Re: Stop charging by software
Posted: 28 Jul 2016 19:47
by bichlepa
Unfortunately it doesn't work. The commant
unplug doesn't exist on my phone. I also tried to use
set ac 0. This caused the trigger "Power source disconnected" to trigger and the phone showed that the charger is disconnected. Also the accu level didn't change. But still it has charged. After using the command
reset and replugging the charger the level jumped to a higher value.
Therefore this is right:
Martin wrote:this just fakes a few internal software toggles