fix: moniteur imprimante ignore les imprimantes offline (non branchées)
🚀 Deploy — JH Photomaton / 🔍 Vérification (push) Has been cancelled
🚀 Deploy — JH Photomaton / 🍓 Deploy sur le Pi (push) Has been cancelled

This commit is contained in:
2026-07-17 17:25:47 +02:00
parent 31f4023f16
commit 5bc55c7591
+4 -2
View File
@@ -107,9 +107,11 @@ async def _printer_monitor_loop(printer_svc: PrinterService, led_svc: LEDService
while True:
try:
statuses = await printer_svc.get_printers_status()
# "offline" = imprimante absente du réseau → normal si non branchée
# On alerte uniquement si l'imprimante est joignable MAIS en panne
# (state=disabled/stopped avec des raisons d'erreur concrètes)
has_error = any(
s.get("state") in ("disabled", "error", "offline")
or bool(s.get("reasons"))
s.get("state") in ("disabled", "error") and bool(s.get("reasons"))
for s in statuses
)
current = led_svc.current_effect