Skip to content

Plugin: log battery readings to CSV - #107

Draft
tozes wants to merge 1 commit into
Adolanium:mainfrom
tozes:plugin/battery-log
Draft

tozes wants to merge 1 commit into
Adolanium:mainfrom
tozes:plugin/battery-log

Conversation

@tozes

@tozes tozes commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

What and why

battery_log: true in the gadget platform's extra keeps each device's battery readings in a CSV under the plugin's data directory (plugin-data/gadget/battery/<device>.csv): time, unix seconds, millivolts, percent, charging, external power and battery present. A row every 30 s and at once when charging or USB power changes, only for readings with a voltage or percent. Device ids are sanitized for file names, and a file rolls over to <device>.1.csv at 8 MB. Off by default.

It exists to calibrate a board's battery percentage from a full discharge, which is how the AMOLED-1.75C's curves were measured.

Part of a series for the AMOLED-1.75C; the physical report is #103.

How you know it works

Tests on this branch (based on 8069101):

  • hermes-gadget build-sim --test: core 121/121.
  • tests/test_plugin_units.py (rows, rollover) and tests/test_adapter_hermes.py (only when enabled, only state readings), the latter run against Hermes v0.21.6.
  • pytest without the simulator-window tests (no virtual display here): 271 passed, 31 skipped.

In use: enabled on a Hermes gateway logging the 1.75C since 2026-10-08 20:02, about 1,500 rows so far across a full discharge and several charges.

Documentation and sources

docs/hermes-integration.md (config example and a paragraph) and a changelog line under ### Hermes plugin.

Checklist

  • One change per PR, with a title that says what it does
  • Relevant docs updated, or the reason no changes apply is explained
  • Verification results and remaining limitations recorded
  • Applicable vendor sources, licenses, and contributor credit retained
  • For a new board: the checklist in CONTRIBUTING.md (not a new board)

@tozes
tozes force-pushed the plugin/battery-log branch from b4ccc02 to 89164ad Compare October 10, 2026 07:20
`battery_log: true` in the gadget platform's `extra` keeps each device's
battery readings in a CSV under the plugin's data directory
(plugin-data/gadget/battery/<device>.csv): time, unix seconds, battery
millivolts, percent, charging, external power and battery present. A row
every 30 s, and at once when charging or USB power changes; rows only when
a reading has a voltage or percent. Device ids are sanitized for file
names, and a file rolls over to <device>.1.csv at 8 MB. Off by default.

It exists to calibrate a board's battery percentage from a full discharge.

Tests: test_plugin_units.py (rows and rollover), test_adapter_hermes.py
(only when enabled, only state readings).
@tozes
tozes force-pushed the plugin/battery-log branch from 89164ad to 2fc4548 Compare October 10, 2026 07:40

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant