This release is a pre-release and may not be stable for production use.
PowerGuess
PowerGuess estimates or measures the power draw of a Linux device. It is a pure Python library with no I/O bridge. It computes watts and reports where each number came from. The Home Assistant / MQTT bridge and system telemetry live in the companion linux2mqtt project, which builds on this library.
Install
pip install powerguess # core (psutil, pexpect)
pip install powerguess[ina219] # + INA219 I²C power-monitor support
What it does
PowerStatMonitor picks the best available whole-device power source and
labels every reading with its provenance. A guess is never mistaken for a
measurement.
| Source | When | Accuracy |
|---|---|---|
| INA219 (I²C) | a power-monitor HAT is wired | measured |
Pi PMIC (vcgencmd) |
Raspberry Pi 5, whole-board, no hardware | measured |
Battery rails (/sys) |
devices on battery | measured |
powerstat |
x86 fallback | measured |
| CPU-load estimate | everything else | estimated, with an error band |
The estimate sits inside a bounded envelope: an idle floor and a peak/PSU ceiling. A per-device calibration pins it to your hardware. See docs/theory.md.
Use
from powerguess import PowerStatMonitor
monitor = PowerStatMonitor()
reading = monitor.measure()
tag = reading.source if reading.measured else f"estimate ±{reading.error_margin}W"
print(f"{reading.power:.1f} W [{tag}]")
print("envelope:", monitor.bounds()) # (idle floor, peak ceiling)
Calibrate it (manual, learned, or PSU-bounded):
from powerguess import PowerStatMonitor, Calibration
cal = Calibration(idle_power=2.7, load_power=6.4) # or Calibration.from_psu(...)
monitor = PowerStatMonitor(calibration=cal)
Docs
- Theory: the bounded-estimate model.
- Calibration: pin the estimate to a device.
- Dataset & model: collect
features → measured watts(dataset.py) and fit a predictor (train.py).
Related projects
- linux2mqtt: publishes the telemetry this library computes to Home Assistant over MQTT.
License
Apache-2.0
Metadata
Release files for powerguess 0.1.0a3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| powerguess-0.1.0a3.tar.gz | 21.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| powerguess-0.1.0a3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.9 kB
Release files / powerguess-0.1.0a3.tar.gz
| Download URL | powerguess-0.1.0a3.tar.gz |
|---|---|
| Size | 21.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
873bd70100ce6b9ae36e3be4533cf7dd01768967073de12fa399a135b05f3350
|
|
BLAKE2b-256 checksum How to use checksums |
8d5b84efffd8eacf8550db28496c84e0fdb5ce94d5e9f51209268f76fd0ac260
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / powerguess-0.1.0a3-py3-none-any.whl
| Download URL | powerguess-0.1.0a3-py3-none-any.whl |
|---|---|
| Size | 20.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2c7394b72de7cc8170748ac4daae4f283b255a31a6666e7c5030e88012a85f8c
|
|
BLAKE2b-256 checksum How to use checksums |
dc753700602da91f71f6b1e7a397bd17c22c6d7d6ee0ade0ca425f36e6933cf9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|