fix: moniteur imprimante ignore les imprimantes offline (non branchées)
This commit is contained in:
@@ -107,9 +107,11 @@ async def _printer_monitor_loop(printer_svc: PrinterService, led_svc: LEDService
|
|||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
statuses = await printer_svc.get_printers_status()
|
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(
|
has_error = any(
|
||||||
s.get("state") in ("disabled", "error", "offline")
|
s.get("state") in ("disabled", "error") and bool(s.get("reasons"))
|
||||||
or bool(s.get("reasons"))
|
|
||||||
for s in statuses
|
for s in statuses
|
||||||
)
|
)
|
||||||
current = led_svc.current_effect
|
current = led_svc.current_effect
|
||||||
|
|||||||
Reference in New Issue
Block a user