using A20 with Debian image, sourced by a 9v ac adaptor
I'm trying to use a battery connected to jst as a UPS, principally while closing some processes and shutdown in an eventually failure of the main power (220v)
I can't figure out how to know when the board is sourced through barrel or not, is there a way to know about ?
I would like to use a python script running as a daemon
please, any advice will be appreciated
thanks in advance
I'm not on the device but from memory look in
/sys/class/power I think? Have a dig around !
There are folders for ac and battery, if current_now in battery is zero there's a good chance its using mains!
You can also pick up the battery percentage too
A simple cron job every 5 mins or so to check ac and then battery percentage should be simple to make...
if you thing you have a high drain the battery might stop supplying sufficient current before it reaches 0% so you may want to test the battery to exhaustion a few times recording %age
great !
that's it !
thank you a lot !