added python tool inital version

This commit is contained in:
2026-02-25 10:09:17 +01:00
parent 288b1e45ef
commit 80c0e825a7
26 changed files with 369 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
# core/commands/info.py
from core.connection import BuzzerError
def execute(conn) -> dict:
"""Holt die Systeminformationen und gibt sie als strukturiertes Dictionary zurück."""
lines = conn.send_command("info")
if not lines:
raise BuzzerError("Keine Antwort auf 'info' empfangen.")
parts = lines[0].split(';')
if len(parts) != 5:
raise BuzzerError(f"Unerwartetes Info-Format: {lines[0]}")
protocol_version = int(parts[0])
if protocol_version != 1:
raise BuzzerError(f"Inkompatibles Protokoll: Gerät nutzt v{protocol_version}, Host erwartet v1.")
app_version = parts[1]
f_frsize = int(parts[2])
f_blocks = int(parts[3])
f_bfree = int(parts[4])
total_kb = (f_blocks * f_frsize) / 1024
free_kb = (f_bfree * f_frsize) / 1024
used_kb = total_kb - free_kb
percent_used = (used_kb / total_kb) * 100 if total_kb > 0 else 0
return {
"protocol_version": protocol_version,
"app_version": app_version,
"total_kb": total_kb,
"free_kb": free_kb,
"used_kb": used_kb,
"percent_used": percent_used
}