Tracks the battery discharge rate during sleep.
The script is executed automatically on sleep enter and exit and persists the current timestamp and energy level in a database.
This data can be later used to calculate and plot the discharge rate.
python3and the following modulesmatplotlibfor plotting historical data
systemdfor automatic execution on sleep enter and exit
- copy the script
main.pyto/usr/local/bin/sntrackand mark it as executable - place a symlink of the script
/usr/local/bin/sntrackto the directory/usr/lib/systemd/system-sleep/
While using a battery as the power source, suspend and wake the system. Run sntrack plot to plot the recorded data.
Short sleep durations are discarded by default.
For more information see the output of the command sntrack -h.