No apps here. It is just a Wifi-plug and Termux. It reads the battery voltage with termux-battery-status and turns the plug onoff. It does various other things too and there are issues, which I dont remember, so here is the entire program.
import os,json,time
loki="../batcon.log"
f=open(loki,'w')
f.write('ALKU\n')
f.close()
lokinolla=time.time()
alku=True
while True:
b=json.loads(os.popen("termux-wifi-connectioninfo").read())
if b['ip'] == "192.168.1.205":
os.system("termux-api-start")
os.system("termux-wake-lock")
a=json.loads(os.popen("termux-battery-status").read())
if alku:
alku=False
os.system('termux-notification -c "BATCON TOIMII"')
p=a['percentage']
s=a['status']
cur=a['current']
if p<70 and s=="DISCHARGING":
yes=int((time.time()-lokinolla)/60)
if yes>0:
fi=open(loki,'a')
fi.write(str(yes)+" "+str(cur/1000)+"\n")
fi.close()
os.system('curl 192.168.1.156/ON')
lokinolla=time.time()
if s=="CHARGING":
if p>70: os.system('curl 192.168.1.156/OFF')
if p==81:
os.system("termux-tts-speak -l fi LASTAUS EI LOPU &")
if 0!=os.system("ping -c 1 192.168.1.156"):
os.system("termux-tts-speak -l fi LATURI EI VERKOSSA &")
time.sleep(30)
if 0==os.system("ping -c 1 192.168.1.118"):
os.system("termux-volume music 15 &")
os.system("termux-tts-speak -l en YOUR FRONT DOOR IS OPEN! &")
time.sleep(30)
if 0==os.system("ping -c 1 192.168.1.219"):
os.system("termux-volume music 15 &")
os.system("termux-tts-speak -l fi HUOMIO... JÄÄKAAPIN OVI ON AUKI ! &")
os.system("termux-toast -b yellow -c black JÄÄKAAPPI")
time.sleep(30)
else:
alku=True
print('No KOTIKONE')
time.sleep(30)