Repository navigation
Architecture
WattSeal is a Rust workspace made up of four crates:
wattseal/ ← Root binary (tray icon, lifecycle management)
├── collector/ ← Background sensor polling, power estimation
├── mqtt/ ← Optional MQTT publisher
├── common/ ← Shared types, SQLite layer, utilities
└── ui/ ← Iced GUI (dashboard, hardware info, settings, charts)
The root binary spawns the UI as a separate process, so a UI crash can't take down the collector, and vice versa.
-
collectorpolls every sensor once per second. - Raw
SensorDatais computed intoComputedSensorData(addsTotal, per-process attribution, top-10 ranking). - Written to SQLite and/or published to MQTT, depending on flags.
-
uireads the same SQLite file (WAL mode allows concurrent read/write), polling once per second.
SQLite, WAL mode, power_monitoring.db next to the executable. One table per sensor type, plus hardware_info, devices, apps, ui_settings, and component_all_time_data for cumulative totals.
A background task averages raw per-second data older than 24 hours into hourly buckets, keeping the database small over months of use.
Schema is versioned (PRAGMA user_version), the collector migrates on startup, the UI waits for the schema to be current before opening.
Only one collector can run against a given database, enforced via an OS file lock (power_monitoring.db.collector.lock).
-
Rust stable toolchain (version pinned in
rust-toolchain.toml). -
On linux, install the build deps for the tray icon, not needed at runtime but required to build the Linux version:
sudo apt install libgtk-3-dev pkg-config libxkbcommon-dev libwayland-dev
Clone the repository:
git clone https://github.com/daminoup88/wattseal.gitcd wattsealDebug build and run:
cargo runRelease build:
cargo build --release
⚠️ Elevated privileges are required to access hardware energy counters. Run with administrator rights on Windows (you will be prompted to elevate), or usesudoon Linux.