Created
January 19, 2015 08:28
-
-
Save meepoSenpai/29a6116b1279da2a4f2c to your computer and use it in GitHub Desktop.
DualBatteryStatus Python Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
bat1 = int(open('/sys/class/power_supply/BAT1/capacity', 'r').read()) | |
bat0 = int(open('/sys/class/power_supply/BAT0/capacity', 'r').read()) | |
print(int((bat1+bat0)/2)) | |
except(Exception): | |
bat0 = int(open('/sys/class/power_supply/BAT0/capacity', 'r').read()) | |
print(int(bat0)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment