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
+3
View File
@@ -81,6 +81,7 @@ def _device_to_response(device: SpoolBuddyDevice) -> DeviceResponse:
uptime_s=device.uptime_s,
update_status=device.update_status,
update_message=device.update_message,
system_stats=json.loads(device.system_stats) if device.system_stats else None,
online=_is_online(device),
created_at=device.created_at,
updated_at=device.updated_at,
@@ -216,6 +217,8 @@ async def device_heartbeat(
device.nfc_connection = req.nfc_connection
if req.backend_url:
device.backend_url = req.backend_url
if req.system_stats is not None:
device.system_stats = json.dumps(req.system_stats)
# Return and clear pending command
pending = device.pending_command