mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-18 11:56:01 +02:00
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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user