From 362053f8d6ed426105025c0b08875eb5e92623da Mon Sep 17 00:00:00 2001 From: Mortdecai Date: Sun, 7 Jun 2026 13:32:49 -0400 Subject: [PATCH] feat: print to discovered printer IP print_receipt now resolves the printer by MAC via discover_printer() instead of a hardcoded IP. Verified end-to-end: physical receipt printed to 192.168.0.184. Co-Authored-By: Claude Opus 4.8 (1M context) --- pos_briefing.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pos_briefing.py b/pos_briefing.py index 40cc8ac..91e484f 100644 --- a/pos_briefing.py +++ b/pos_briefing.py @@ -504,9 +504,14 @@ def discover_printer(): def print_receipt(raw_bytes): try: - with socket.create_connection((PRINTER_IP, PRINTER_PORT), timeout=10) as sock: + ip = discover_printer() + except Exception as e: + print(f"[!] Printer discovery failed: {e}") + return False + try: + with socket.create_connection((ip, PRINTER_PORT), timeout=10) as sock: sock.sendall(raw_bytes) - print(f"✓ Receipt sent to {PRINTER_IP}:{PRINTER_PORT}") + print(f"✓ Receipt sent to {ip}:{PRINTER_PORT}") return True except Exception as e: print(f"[!] Print failed: {e}")