giampaolo / psutil

Cross-platform lib for process and system monitoring in Python
BSD 3-Clause "New" or "Revised" License
10.08k stars 1.37k forks source link

[Linux] Get laptop charging speed (in Watts) #2393

Open nschloe opened 3 months ago

nschloe commented 3 months ago

When charging my laptop, I'd love to know how fast it goes (in Watt). This tells me if I I'm fast-charging or if my cable/charger isn't very good.

Right now, I use to command-line call

upower -i /org/freedesktop/UPower/devices/battery_BAT0

to get

[...]
   energy-rate:         10,55 W
[...]

(Not very fast at all.)

The value can also be retrieved via

/sys/class/power_supply/BAT0/power_now

(Given in microwatts.)