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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file powerguess-0.1.0a3.tar.gz.
File metadata
- Download URL: powerguess-0.1.0a3.tar.gz
- Upload date:
- Size: 21.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
873bd70100ce6b9ae36e3be4533cf7dd01768967073de12fa399a135b05f3350
|
|
| MD5 |
c5f98c9c0abea733cbcb962040e6e7b8
|
|
| BLAKE2b-256 |
8d5b84efffd8eacf8550db28496c84e0fdb5ce94d5e9f51209268f76fd0ac260
|
File details
Details for the file powerguess-0.1.0a3-py3-none-any.whl.
File metadata
- Download URL: powerguess-0.1.0a3-py3-none-any.whl
- Upload date:
- Size: 20.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c7394b72de7cc8170748ac4daae4f283b255a31a6666e7c5030e88012a85f8c
|
|
| MD5 |
24277d59d50f23f1d9c1044e6aca63ae
|
|
| BLAKE2b-256 |
dc753700602da91f71f6b1e7a397bd17c22c6d7d6ee0ade0ca425f36e6933cf9
|