Bash wrapper suite for automating Bambu Lab 3D printer workflows. Provides pre-flight validation, job queuing with dry-run support, and background monitoring with notifications.
This suite provides three main capabilities:
- Pre-flight Validation (
bambu-validate.sh) - Checks printer state, connection, and AMS status before starting jobs - Job Queuing (
bambu-queue.sh) - Main wrapper with dry-run mode, confirmation prompts, and logging - Background Monitoring (
bambu-monitor.sh) - Tracks print progress, logs events to JSONL, sends notifications on completion/failure
# Clone the repository
git clone https://github.com/rowbotik/bambu-cli-automation.git
cd bambu-cli-automation
# Make scripts executable
chmod +x *.sh
# Optional: Add to PATH
sudo ln -s $(pwd)/bambu-queue.sh /usr/local/bin/bambu-queue
sudo ln -s $(pwd)/bambu-validate.sh /usr/local/bin/bambu-validate
sudo ln -s $(pwd)/bambu-monitor.sh /usr/local/bin/bambu-monitor- bambu-cli - The underlying CLI for Bambu printer control
jq- JSON processing utilitybash4.0+
# Check default printer
./bambu-validate.sh
# Check specific printer
./bambu-validate.sh --printer H2D
# Get JSON output
./bambu-validate.sh --json# Basic usage
./bambu-queue.sh model.3mf
# Specify printer
./bambu-queue.sh model.3mf --printer H2D
# Dry run (see what would happen without executing)
./bambu-queue.sh model.3mf --dry-run
# Print specific plate from 3MF
./bambu-queue.sh model.3mf --plate 2# Monitor current job (auto-detects)
./bambu-monitor.sh
# Monitor specific printer with custom duration
./bambu-monitor.sh --printer H2D --duration 480 # 8 hours max
# Monitor with specific job ID
./bambu-monitor.sh --job-id 12345 --printer H2D┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ bambu-queue.sh │────▶│ bambu-validate.sh│────▶│ bambu-cli │
│ (entry point) │ │ (pre-flight check)│ │ (printer API) │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│
│ ┌──────────────────┐
└─────────────▶│ bambu-monitor.sh │────▶ JSONL logs
│ (background) │────▶ Telegram alerts
└──────────────────┘
~/Sync/
├── print-jobs.log # Human-readable job log
├── printer-events.jsonl # Structured event data
└── print-queue/ # Queue directory for files
The monitor outputs structured JSONL events:
{"timestamp": "2024-01-15T10:30:00Z", "agent": "bambu-cli-automation", "event_type": "monitor_started", "job_id": "1705312200", "printer": "H2D", "details": {"max_duration_minutes": 240}}
{"timestamp": "2024-01-15T10:35:00Z", "agent": "bambu-cli-automation", "event_type": "state_change", "job_id": "1705312200", "printer": "H2D", "details": {"from": "", "to": "printing", "progress": 0}}
{"timestamp": "2024-01-15T12:30:00Z", "agent": "bambu-cli-automation", "event_type": "print_completed", "job_id": "1705312200", "printer": "H2D", "details": {"progress": 100, "elapsed_minutes": 120}}Environment variables (optional):
export BAMBU_DEFAULT_PRINTER="H2D"
export BAMBU_LOG_FILE="${HOME}/Sync/print-jobs.log"
export BAMBU_EVENTS_FILE="${HOME}/Sync/printer-events.jsonl"MIT