Repository navigation
Fleet and Drivers
Machines, how the farm reaches them, and the one rule that matters more than any other in this area: a driver never simulates. A system that fails into fiction can hide a non-functional core indefinitely.
Normalized across brands, so the scheduler and the boards never learn a vendor's vocabulary.
| State | Means |
|---|---|
offline |
Could not be reached. Recorded, alerted, never guessed at |
idle |
Empty and available |
preparing |
Warming up, levelling |
printing |
Running a job |
paused |
|
finished |
Done, part still on the bed |
error |
|
maintenance |
Out of service by decision |
Two derived properties carry real weight:
-
is_busy—preparing,printing,paused. -
accepts_job—idleonly.finishedis deliberately excluded, and that exclusion came from real hardware: a Bambu reportingFINISHshows 100 %, 785/785 layers and a nozzle cooled to 29 °C — numerically indistinguishable from idle, with the finished part still sitting on the bed.finishedclears toidlewhen a human removes the part.
| Mode | Means |
|---|---|
lan |
Driven directly over the farm LAN |
cloud |
Via a vendor cloud |
manual |
Tracked, not driven — state advanced by operators in the UI |
mock |
In-process virtual printer, for the virtual farm |
manual is a first-class citizen (ADR-0011), not a placeholder. It is how an Elegoo,
or any printer whose driver does not exist yet, takes part in the fleet — and it is the
permanent fallback that turns a locked-down machine into a tracked one rather than a
broken one.
mock raises at import time if the environment is production. Simulation has a
name, a driver and a refusal to load where it must not be.
Brand-neutral by construction:
class PrinterDriver(Protocol):
async def connect(self, conn: ConnectionInfo) -> None: ...
async def capabilities(self) -> Capabilities: ...
def telemetry(self) -> AsyncIterator[Telemetry]: ...
async def upload(self, plate: PreparedPlate) -> RemoteFileRef: ...
async def start(self, ref: RemoteFileRef, ams_map: AmsMapping) -> JobHandle: ...
async def pause(self) / resume(self) / cancel(self, reason) -> None: ...| Driver | Transport | Status |
|---|---|---|
bambu |
MQTT over TLS :8883 for telemetry and commands; FTPS :990 for the 3MF; SSDP for discovery |
Built. Never yet talked to a printer through the product's own path — see Project Status |
manual |
none | Built. How Elegoo machines are tracked today |
mock |
in-process, configurable timing and failure injection | Built |
elegoo (SDCP), moonraker, prusalink
|
— | Not built. Their purpose is to prove the abstraction is not Bambu-shaped |
Rules enforced in code, not by review:
- A driver returning stale or unavailable data must raise
DriverUnavailable. The fleet context maps that toofflineand raises an attention event. No fallback data. Ever. - Every driver ships contract tests against recorded protocol fixtures, so a firmware change breaks CI rather than production. A driver without fixtures does not merge.
Run against a real X2D in LAN mode. This is the specification the driver is built from,
which is why it is not guesswork —
docs/BAMBU-LAN-PROTOCOL.md.
Telemetry and control: proven. Username bblp, password is the LAN access code,
self-signed certificate. Subscribe device/<serial>/report, publish to
device/<serial>/request; a pushall command triggers a full state dump.
File transfer: proven at the transport level, with the write itself pending storage
in the test machine. The server is vsftpd, and the trap is TLS session reuse — the data
connection must resume the control connection's TLS session, which Python's ftplib
does not do by default. Without the fix every listing comes back empty and every upload
fails.
Three things real hardware corrected, each of which would have been a plausible wrong assumption:
-
FINISHis not "available" — henceaccepts_jobcoveringidleonly. -
tray_coloris 8-character RGBA (FFFFFFFF), not#RRGGBB. -
subtask_nameis the print profile, not a filename — the observed value was"0.2mm layer, 2 walls, 15% infill". It cannot correlate a running print back to a job, so the driver needs its own correlation key.
Discovery is optional and must never be a prerequisite. Nothing was heard on the broadcast ports in 45 s in the test environment; a printer whose IP is known is perfectly usable.
Printer access codes are encrypted at rest and never in git (ADR-0014). The console
writes them; nothing reads them back out. Hardware test credentials live in a
git-ignored printers.local.toml, and without that file every hardware contract test
skips — so CI is untouched and nobody needs a printer to work on the rest of the
system.
workers/telemetry.py runs every 5 s by default and asks every reachable machine what
it is doing. The scheduler and telemetry loops share a driver pool that keeps
connections alive between passes.
Rebuilding a driver per tick would reconnect per tick — on a fifty-machine farm that is a reconnect storm, and a Bambu driver holds an MQTT/TLS session. A connection is replaced only when the printer's brand, mode, host, serial or access-code state changes; renaming a printer does not disturb it.
This is also why drivers are deliberately not part of /health/ready: the pool of
live connections belongs to the worker process, so the API has no connection state to
report and a check there would have to invent one.
telemetry_samples is partitioned by month (ADR-0018) with explicit retention —
default 90 days. metric_rollups holds the summarised figures the fleet screens read,
and GET /fleet/metrics and /fleet/metrics/{printer_id} serve them. Seconds only,
behind view_production — note that this is the farm's measured occupancy, not a
Prometheus scrape endpoint.
The rule from the top of the repository applies hardest here:
A null reading is "not measured", not
0. An hour with no telemetry is not an idle hour. An unknown id must 404 rather than answer an empty grid — an all-null response reads as "this thing did nothing". A denominator must be what was observed, never the roster; otherwise the worse the coverage, the healthier the farm looks, and the error is silent and flattering.
Each printer carries maintenance operations with a periodicity and the materials each consumes:
nozzle_change · belt_tension · lubrication · bed_level · filter_change ·
deep_clean
POST /printers/{id}/services/{operation_id}/complete records a completion, which
advances the next-due date. A machine in maintenance is ineligible for work
(reject.in_maintenance), which is a transient rejection — it clears when the service
completes.
The dedicated service screen from the design kit is not built; the underlying
ServiceOperation model is. It is the one unbuilt screen that depends on nothing else.
Console → Fleet (/FLEET/PRINTERS). Permission: view_production to see,
manage_fleet to add or change machines, operate_printer to pause, resume or cancel.
The same DataTable as materials: sortable headers, state counters above the table, a
detail drawer with properties, amortization (idle and printing), total print time and
next service.
- Scheduling and Dispatch — how capability becomes eligibility
- Materials and Inventory — AMS slots and what is mounted
- Project Status — what is proven against hardware and what is not
Printorian wiki · the code is the source of truth · open work lives in issues · current state in HANDOFF.md
Concepts
Workflow
Lifecycles
- Order Lifecycle
- Job Lifecycle
- Scheduling and Dispatch
- Materials and Inventory
- Fleet and Drivers
- Post-Production and Packing
Money
Running it
- Installation
- Configuration
- Deployment
- Operations
- Backup and Restore
- Database Maintenance
- Troubleshooting
Building it