Skip to main content

Crate bambu_rs

Crate bambu_rs 

Source
Expand description

bambu-rs — a clean-room library and CLI for monitoring and controlling Bambu Lab 3D printers over the LAN.

This crate is built clean-room from the protocol documentation (OpenBambuAPI) and direct observation of real hardware — it does not depend on, nor copy from, any existing Bambu library implementation.

The library (core) is the first-class, reusable artifact: it owns the pure protocol logic (state model, delta merge, command envelopes, the firmware capability registry, the safety policy and verify predicates) with no I/O. The bambu binary is a thin consumer of this library, and a future MCP server will be another.

Reliable control requires the printer to be in LAN-only + Developer Mode (since the Jan-2025 Authorization Control System); read-only telemetry is broadly available.

Modules§

camera
Camera snapshot — the A1/P1 chamber-image stream.
captures
Listing finished/in-progress capture runs on disk — the reusable read side of the timelapse feature, so the CLI and the server present the same recordings.
cli
The bambu command-line interface (behind the cli feature).
client
LAN MQTT client — the I/O layer.
config
Printer connection profiles and credential resolution.
core
core — pure, I/O-free protocol logic. This is the main test surface: every item here is unit-testable without a network or a real printer.
ftp
FTPS file transfer — the printer’s LAN file store.
park
Live “parked frame per layer” capture — the reusable I/O runner for the smooth timelapse. The pure detector lives in crate::core::park; this owns the I/O and is a first-class library module so the CLI, the server, and other consumers all drive it the same way (not locked behind the server feature).
server
The embedded HTTP server — a monitoring + control API (axum) and, when the dashboard feature is on, the React SPA (embedded via rust-embed). Behind the server feature; another consumer of the library, like the CLI.
tls
LAN TLS for the printer’s self-signed X.509 v1 certificate — shared by the MQTT client, FTPS, and the camera so the whole crate uses one TLS stack (rustls; no OpenSSL).