Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Python to Access Battery Status in Ubuntu

I am trying to come out with a small python script to monitor the battery state of my ubuntu laptop and sound alerts if it's not charging as well as do other stuff (such as suspend etc). I really don't know where to start, and would like to know if there is any library for python i can use. Any help would be greatly appreciated. Thanks

like image 838
SamAko Avatar asked May 22 '13 19:05

SamAko


2 Answers

I believe you can find the information you are looking for in

/sys/class/power_supply/BAT0
like image 53
Fredrik Pihl Avatar answered Nov 08 '22 21:11

Fredrik Pihl


Here I found a solution that might be helpful for you too. http://mantoshkumar1.blogspot.in/2012/11/monitoring-battery-status-on-linux.html

like image 44
james Avatar answered Nov 08 '22 20:11

james