Using Termux on an Android smartphone and a WiFi Smart Plug the phone can control its charging via half hour cron'ed termux-battery-status, MQTT and openHAB to control the plug. Termux hasn't battery status events (Termux issue 382) hence cron.
When I get home, I plug in the phone and manually switch on the WiFi plug.
I wonder what is the best charging plan for battery life.
Currently the plan is simply
if between 10pm and 5am
if charge < 20%
power on plug
else
if charge < 50%
power on plug
if charge > 80%
power off plug
at 05:00am
power on plug
(at 7:00am the charge should be at 80%)
Do you know a better plan? Are the 50% / 80% limits ok?
This way I also control an old tablet that is used as smart home display and speaker, but as it is alway at home I only let it cycle between 30% and 80%.