Device Hub: install, pair, and print
The on-premise bridge between browser apps and warehouse hardware: install on the workstation, pair once, connect printers/scales, and watch the print queue in the print center.
What Device Hub is#
A browser sandbox cannot open raw TCP / USB / serial ports, so web WMS cannot talk directly to ZPL printers or electronic scales. Device Hub is a tray-resident app installed on each warehouse workstation (Windows PC / Mac) that bridges “browser ↔ hardware”: it auto-starts with the machine and runs unnoticed. It’s built with Tauri v2 — one codebase for Windows + macOS (Intel and Apple Silicon).
Download and install#
- Get it from the official download page (/zh/download or /en/download): the page auto-recommends Mac DMG or Windows MSI (universal) by your platform.
- Download → install → next-next-finish. The whole thing needs zero manual steps — no drivers to install by hand, no commands, no config files to edit.
- First-run setup wizard: ① it shows a pairing code → ② it auto-discovers printers (mDNS + USB); tick the devices and set the default label printer → ③ done.
- Auto-starts with the machine and runs quietly in the background.
Pairing#
- The Hub tray icon shows a 6-digit pairing code.
- Enter it once on the web side — in the pairing dialog that pops up when printing, or in Admin → Print Devices (Hub pairing is managed there) — and pairing is done.
- After pairing, a token is issued (stored in the browser localStorage); every WebSocket handshake carries the token from then on. The Hub only binds 127.0.0.1 by default, so it can’t be scanned from outside; LAN mode (for phone/tablet printing) is opt-in and still requires the token.
Connecting printers#
- ZPL printers (Zebra and similar): USB or network port 9100; the Hub sends raw ZPL and polls printer status (out of paper / ribbon / cover open).
- All web print buttons go through the SDK to the Hub. If the Hub isn’t installed, the print button pops a “Device Hub not detected” card with the download link for your platform; downloading the ZPL remains as a fallback.
- Default label printer: mark it on the print-devices page (is_default_label_printer) so print buttons know where to send jobs.
- Electronic scales connect over serial / USB-serial, with configurable baud rate, prefix/suffix and unit, supporting common continuous-output protocols (e.g. Mettler Toledo, CAS, AND). Register the scale on the print-devices page as a scale-type device.
Phone cloud-print pipeline#
- Tap print label on the phone web → POST /api/wms/print-jobs → the print_jobs table (queued, carrying the ZPL content).
- The Device Hub on a warehouse workstation subscribes to Supabase Realtime (with a 3-second polling fallback) → atomically claims the job (UPDATE … WHERE status=queued — zero rows means it was cancelled, so it never prints; this prevents misprints).
- Prints locally on the Zebra → writes back done/failed → the phone polls the status for feedback.
Print center (Admin app)#
- Print queue: the full print_jobs table; filter by status/warehouse/printer/label type/time. Jobs unhandled for >5 minutes are highlighted; queued jobs can be cancelled, failed jobs can be reprinted; Realtime live refresh; after submitting from a WMS print button you get a jump link here.
- Print devices: the full devices table; online/offline computed from the last_seen_at heartbeat (2-minute threshold); connection type, default-label-printer flag, owning Hub; Hub pairing management lives here too.