Andy DixonandCopilot 60c787d041 Infer charging state from trend of last 50 data points
When no state field is configured, the panel now uses a least-squares
slope over the most recent ≤ 50 data points to determine whether the
battery is charging, on battery, or stable — instead of relying on the
overall first-to-last rate which could be misleading over long ranges.

Priority order for state resolution:
1. Explicit state field (if enabled and configured)
2. Inferred trend from last ≤ 50 points (always computed)

The slope threshold (0.01) avoids flicker from sensor noise.
Status badge now shows 'On Battery' instead of 'Discharging'.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-24 13:20:27 +01:00
2025-10-11 18:48:08 +02:00
2025-10-11 17:26:33 +01:00
2025-10-11 18:36:06 +02:00

Grafana Battery Visualisation

I hate writing documentation, and since I will have ADHD brain, I will forget how to do this.

npm install
npm run build
cp -r dist /var/lib/grafana/plugins/andydixon-battery-panel

in /etc/grafana/grsfana.ini add andydixon-battery-panel to allow_loading_unsigned_plugins

S
Description
Grafana battery visualisation
Readme GPL-3.0
276 KiB
Languages
TypeScript 87%
JavaScript 9.5%
Dockerfile 2.8%
Shell 0.7%