Skip to content

Instantly share code, notes, and snippets.

@karolherbst
Created April 6, 2020 11:11
Show Gist options
  • Save karolherbst/1b865c0fe72b178dae4138f0d6f79191 to your computer and use it in GitHub Desktop.
Save karolherbst/1b865c0fe72b178dae4138f0d6f79191 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import os;
file_cur = open("/sys/class/power_supply/BAT0/current_now")
file_vol = open("/sys/class/power_supply/BAT0/voltage_now")
print(int(file_cur.readlines()[0][:-1])/1000000 * int(file_vol.readlines()[0][:-1])/1000000)
file_cur.close()
file_vol.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment