feat(printers): airduct mode + status badges + force refresh on printer card

Surface four Home Assistant-style controls on the Printers page card:

  - SD Card badge in the top status row (green / red, icon-only).
  - Enclosure Door badge in the top status row (green / yellow, icon-only).
    Detection per printer family — X1/X1C/X1E read home_flag bit 23, all
    others read top-level `stat` (hex string) bit 23 — so X1 firmware that
    does not flip stat bit 23 stops false-triggering "open". WebSocket
    status-change dedup key now includes door_open so toggling the door
    alone publishes a push, no 30s REST-poll wait.
  - Airduct Mode badge beside the speed control (cooling / heating)
    for P2S/H2D/H2C/H2S; one-click dropdown calls the existing
    set_airduct MQTT command via a new POST /printers/{id}/airduct-mode
    route.
  - Force Refresh entry in the kebab menu — calls the existing
    /printers/{id}/refresh-status endpoint to request a pushall snapshot
    without forcing a reconnect.

  Tests: door-open parsing (X1 home_flag, non-X1 stat, ignore mismatched
  source, invalid hex) and airduct route (validation, not-connected,
  success, failure).
This commit is contained in:
maziggy
2026-04-13 12:50:17 +02:00
parent eec7793955
commit 8af0966e68
23 changed files with 862 additions and 446 deletions
+6
View File
@@ -241,6 +241,7 @@ export interface PrinterStatus {
ipcam: boolean; // Live view enabled
wifi_signal: number | null; // WiFi signal strength in dBm
wired_network: boolean; // Ethernet connection detected
door_open: boolean; // Enclosure door open (X1/P1S/P2S/H2*)
nozzles: NozzleInfo[]; // Nozzle hardware info (index 0=left/primary, 1=right)
nozzle_rack: NozzleRackSlot[]; // H2C 6-nozzle tool-changer rack
print_options: PrintOptions | null; // AI detection and print options
@@ -2643,6 +2644,11 @@ export const api = {
method: 'POST',
}),
setAirductMode: (printerId: number, mode: 'cooling' | 'heating') =>
request<{ success: boolean; message: string }>(`/printers/${printerId}/airduct-mode?mode=${mode}`, {
method: 'POST',
}),
// Chamber Light Control
setChamberLight: (printerId: number, on: boolean) =>
request<{ success: boolean; message: string }>(`/printers/${printerId}/chamber-light?on=${on}`, {