
If you do any amount of 3D printing on a Bambu P1S, you know the drill: modern Core-XY machines run fast, and when a failure happens, it doesn’t waste time. Spaghetti, knocked-over supports, and blobbed hotends can turn half a spool of filament into an expensive bird’s nest before you even check your phone. And the spaghetti mess isn’t usually detected until it does something drastic, such as knocking loose the extruder drawer.
I decided to tackle this problem with a clean slate. My primary goal? Go low-code first. Instead of hacking together yet another docker application that expose background services, I wanted to see if I could build a modular, state-driven print monitor orchestrating tools I already run: Home Assistant, n8n, and local (LAN) inference via Ollama.
The Experiment: Pure Zero-Shot Vision
Here is the catch with this first attempt: we aren’t giving the vision LLM any hand-holding or pre-classified examples. No fine-tuning, no pre-trained custom weights. We are passing raw camera snapshots straight into a zero-shot multi-modal model (Gemma 3 4B) with a simple instruction: “Decide if this print failed, and reply with JSON.”
If this experiment works, great! If it struggles, we’ll use the collected dataset to fine-tune our own purpose-built model.
The Architecture at a Glance
Rather than letting a script poll constantly in a vacuum, the system is strictly state-driven:

- Trigger
Home Assistant monitors the Bambu MQTT integration. When print status switches torunningorprepare, it calls an n8n webhook. When the print stops or finishes, it hits the stop webhook. - Orchestrator
n8n manages the active state, 5-minute schedule ticks, and error handling. It remains completely idle when the printer is off. - Vision Feed
go2rtc exposes a single-frame snapshot endpoint (/api/frame.jpeg?src=p1s) so we don’t hold an RTSP video stream open. - Grading
Gemma 3 (4B-IT-QAT) running locally in Ollama inspects each captured frame and returns a structured JSON verdict. - Alerts
Pushover delivers high-priority notifications straight to my phone after two consecutive failure verdicts.
How the Flow Works Step-by-Step
1. Clean Slates on Every Run
One of my hard requirements was that I didn’t want months of old photos cluttering disk space or mixing between jobs. When Home Assistant sends the /print-start hook, n8n executes an SSH command against the local storage pool on my server:
BASE="/srv/.../Printer_Logs"
rm -rf "$BASE/good" "$BASE/bad"
mkdir -p "$BASE/good" "$BASE/bad"
This resets the workspace so every single print job starts with clean, isolated good/ and bad/ folders.
2. Snapshot Grabbing Every 5 Minutes
While the print is active, a 5-minute interval timer grabs a single 720p JPEG frame (~62 KB) from go2rtc and stamps it with a UTC filename like 2026-11-15T21-40-15-945z.jpg. Crucially, because the Bambu P1S camera only allows ~2 simultaneous clients and occasionally drops frames when the official Bambu app connects, we added non-blocking error handling: if a frame is dropped, it logs a CAMERA_TIMEOUT line without false-alerting or crashing the workflow.
What the Watcher Sees (Captured Every 5 Minutes)
Because the P1S camera sits low at the front-left corner of the chamber, the model has to work with a tight angle, a dark textured PEI plate, and a fast-moving toolhead. Here are actual frames captured by the pipeline and sorted into good/ and bad/:




3. The Zero-Shot Gemma 3 Grade
Each captured image is converted to Base64 and sent via HTTP to Ollama (gemma3:4b-it-qat, temperature 0) with a strict JSON prompt:
“You are monitoring a 3D printer camera. Decide whether the print has FAILED. Failure means: loose or stringy filament (spaghetti), tangled blobs, or detached parts. NOT failures: normal parts, toolhead occlusions, or the dark build plate. Reply with JSON only: {“failure”: true|false, “reason”: “…”}”
4. Sorting Images & Reading watcher.log
Once the JSON response is parsed, n8n writes the JPEG into good/ (if OK) or bad/ (if FAIL) and appends a tab-separated line to watcher.log with the timestamp, verdict, consecutive failure count, and the model’s exact reasoning.
Here is an actual slice from watcher.log during a real print run, showing the 5-minute scan cadence, the consecutive failure counter ticking up and resetting, and the job lifecycle hooks:
Preventing Notification Fatigue: The 2-Check Rule
Notice those consec:1 and consec:2 entries in the log above! A low-angle camera with a moving toolhead is tricky: shadows, infill grids, or separate objects on the plate can occasionally trick a zero-shot 4B model into crying wolf. To prevent bogus alerts, n8n tracks consecutiveFailures and only fires Pushover when two consecutive checks (10 minutes apart) fail. Any passing check resets the counter straight back to zero.
5. Shutting Down Cleanly
When Home Assistant detects that the printer state has left running (finished, stopped, or cancelled), it fires the /print-end webhook. n8n flips its static active flag to false, appends JOB_END to watcher.log, and goes back to sleep.
What’s Next? (Model Training Plan B)
This is v1—a low-code prototype built to test the limits of general-purpose local vision models without writing specialized microservices.
Because every 5-minute snapshot is systematically cataloged into good/ and bad/ folders alongside the model’s reasoning in watcher.log, the system is already building its own labeled dataset.
As the real logs above show, zero-shot Gemma 3 4B can spot obvious spaghetti, but still throws occasional false positives on normal multi-part plates. Next up: feeding reference “good” frames into few-shot prompts, and if needed, training a lightweight custom classifier directly on the archive this watcher collects.
Have you tried local vision LLMs for 3D print monitoring? Let me know how your experience compares in the comments!



