#1021396 ITP: batterylog -- laptop battery logging tool

#1021396#5
Date:
2022-10-07 13:51:47 UTC
From:
To:
* Package name    : batterylog
  Version         : none
  Upstream Author : Leonard Lin
* URL             : https://github.com/lhl/batterylog
* License         : GPLv3
  Programming Lang: Python
  Description     : laptop battery logging tool

A simple Python app with few dependencies that reads your
sysfs-class-power numbers and records them to a local sqlite3 db with
an "event" tag.

It was built to track suspend power usage for Framework laptops, but
is flexible/easily extensible to do all kinds of other stuff.
----

This is similar to the already packaged battery-stats, but is a little
more explicit in its output. While battery-stats keeps a text and CSV
log, batterylog stores its entries in a SQLite database.

battery-stats stores new entries every minute, in cron, while
batterylog does it on systemd triggers (like sleep/resume). It could,
in theory, do exactly the same as battery-stats and run in a cron job,
but those are triggers installed by default upstream.

They both keep different records in each entry. battery-stats keep the
charge status (charging/discharging), manufacturer, battery type and
identifier, while batterylog keeps voltages.

both ship similarly-named binaries, battery-stats ships battery-log,
and batterylog ships... batterylog.

batterylog is a single script, ~130 lines of python, quite readable,
while battery-stats is a mix of shell and python, spread over multiple
files.

batterlog was started a few months ago, and is the work of a single
maintainer. batterystats has been around since 2013 and has seen half
a dozen contributors (including myself).

batterystats can generate graphs, and, really, all batterylog
currently does is this:

$ /opt/batterylog/batterylog
Slept for 8.72 hours
Used 6.10 Wh, an average rate of 0.70 W
For your 53.67 Wh battery this is 1.30%/hr or 31.29%/day

But it's surprisingly useful in trying to tune battery life,
especially during suspend.

#1021396#10
Date:
2023-05-25 10:04:24 UTC
From:
To:
Hi,

since I keep on tracking down issues when my battery drains to zero when
in suspend mode I stumbled upon your discussion on framework
community[1] and this ITP.  Did you pushed something on salsa regarding
the packaging I might be able to try?

Kind regards
     Andreas.

[1] https://community.frame.work/t/linux-utility-to-help-track-framework-battery-usage/21729/2

#1021396#15
Date:
2023-05-25 14:28:13 UTC
From:
To:
No. Anything I do I document. :)