Add SpoolBuddy System tab with live OS stats from Raspberry Pi

The daemon now collects CPU temp, core count, load average, memory/disk
  usage, OS info, and system uptime every heartbeat using stdlib-only reads
  from /proc and /sys. Stats are sent as a JSON blob in the heartbeat
  payload, stored in a new system_stats TEXT column, and displayed in a
  new "System" tab in SpoolBuddy Settings with color-coded usage bars.
This commit is contained in:
maziggy
2026-03-26 09:57:09 +01:00
parent 1df5130df2
commit 77cb7158d2
14 changed files with 974 additions and 427 deletions
+14 -10
View File
@@ -108,19 +108,23 @@ class APIClient:
nfc_reader_type: str | None = None,
nfc_connection: str | None = None,
backend_url: str | None = None,
system_stats: dict | None = None,
) -> dict | None:
payload: dict = {
"nfc_ok": nfc_ok,
"scale_ok": scale_ok,
"uptime_s": uptime_s,
"ip_address": ip_address,
"firmware_version": firmware_version,
"nfc_reader_type": nfc_reader_type,
"nfc_connection": nfc_connection,
"backend_url": backend_url,
}
if system_stats is not None:
payload["system_stats"] = system_stats
result = await self._post(
f"/devices/{device_id}/heartbeat",
{
"nfc_ok": nfc_ok,
"scale_ok": scale_ok,
"uptime_s": uptime_s,
"ip_address": ip_address,
"firmware_version": firmware_version,
"nfc_reader_type": nfc_reader_type,
"nfc_connection": nfc_connection,
"backend_url": backend_url,
},
payload,
)
if result and self._buffer:
await self._flush_buffer()