Monitor your 3D printer in real-time as new images arrive!
make monitorThis will continuously watch for new images in today's directory and classify them as they appear.
Output looks like:
============================================================
🖨️ PRINT MONITOR STARTED
============================================================
Monitoring: printer-timelapses/20251110
Polling every 30 seconds...
Press Ctrl+C to stop
============================================================
🟢 [2025-11-10 14:23:45] 20251110T142345.jpg - Print OK (good: 92.3%)
🟢 [2025-11-10 14:24:15] 20251110T142415.jpg - Print OK (good: 94.1%)
🟢 [2025-11-10 14:24:45] 20251110T142445.jpg - Print OK (good: 91.8%)
🚨 [2025-11-10 14:25:15] 20251110T142515.jpg
⚠️ FAILED PRINT DETECTED! (confidence: 87.2%)
🔔 CHECK YOUR PRINTER NOW!
⚫ [2025-11-10 14:25:45] 20251110T142545.jpg - Printer went offline
- Polls directory every 30 seconds (configurable)
- Detects new images that haven't been processed yet
- Classifies each image:
- First: Is printer active or offline?
- If active: Is print good or failed?
- Displays results in real-time (like
tail -f) - Saves state so you can stop/resume anytime
# Monitor today's prints (30 second polling)
make monitor
# Monitor with faster polling (10 seconds)
make monitor-fast
# Monitor a specific date
make monitor-date DATE=20251110
# Demo with existing images (2 second polling)
./demo_monitor.sh# Custom settings
source venv/bin/activate
python src/monitor_print.py \
--image-dir printer-timelapses/20251110 \
--interval 15 \
--offline-threshold 0.8 \
--failed-threshold 0.7- 🟢 Active print - Printer is running
- 🚨 Failed print detected - Immediate alert!
- ⚫ Offline - Printer went idle (only shown on status change)
The monitor remembers which images it has processed in data/monitor_state.json.
Resume monitoring:
# Start
make monitor
# Stop (Ctrl+C)
^C
# Resume later - picks up where you left off
make monitorReset state (reprocess all images):
rm data/monitor_state.json
make monitorStart when you begin a print:
make monitorLeave it running in a terminal window. You'll see each new image classified in real-time.
Run in background and log to file:
nohup make monitor > print.log 2>&1 &
# Check log
tail -f print.logPipe to notification system:
make monitor | while read line; do
if echo "$line" | grep -q "FAILED PRINT DETECTED"; then
notify-send "Print Failed!" "$line"
fi
doneMonitor multiple printers in different terminals:
# Terminal 1
python src/monitor_print.py --image-dir printer1/20251110
# Terminal 2
python src/monitor_print.py --image-dir printer2/20251110How often to check for new images:
- 30 seconds (default) - Good for most prints
- 10 seconds (fast) - For critical prints
- 60 seconds (slow) - For long prints
python src/monitor_print.py --image-dir DIR --interval 60Adjust sensitivity:
Offline threshold (default: 0.7)
- Higher = fewer false "active" detections
- Lower = catch more active prints
Failed threshold (default: 0.6)
- Higher = fewer false alarms
- Lower = catch more potential failures
python src/monitor_print.py \
--image-dir DIR \
--offline-threshold 0.9 \
--failed-threshold 0.8- Start before the print - Catch everything from the beginning
- Use tmux/screen - Keep monitor running even if you disconnect
- Adjust thresholds - Tune based on your false positive rate
- Check the log - Review
print.logafter long prints - Reset state for testing - Use
--resetflag to reprocess images
Check:
# Is directory correct?
ls -la printer-timelapses/20251110/
# Are new images arriving?
watch -n 5 'ls -lt printer-timelapses/20251110/ | head -5'Increase thresholds:
python src/monitor_print.py \
--image-dir printer-timelapses/20251110 \
--offline-threshold 0.9 \
--failed-threshold 0.8Decrease failed threshold:
python src/monitor_print.py \
--image-dir printer-timelapses/20251110 \
--failed-threshold 0.5Add to monitor_print.py:
import requests
def send_discord_alert(message):
webhook_url = "YOUR_WEBHOOK_URL"
data = {"content": f"🚨 {message}"}
requests.post(webhook_url, json=data)
# In the monitoring loop, when failure detected:
send_discord_alert(f"Print failed at {timestamp}!")make monitor | while read line; do
if echo "$line" | grep -q "FAILED PRINT DETECTED"; then
curl -s \
--form-string "token=YOUR_APP_TOKEN" \
--form-string "user=YOUR_USER_KEY" \
--form-string "message=$line" \
https://api.pushover.net/1/messages.json
fi
done# When failure detected, update sensor
curl -X POST \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"state": "failed"}' \
http://homeassistant.local:8123/api/states/sensor.printer_status- Set up automated alerts (Discord, email, SMS)
- Create a web dashboard
- Add more sophisticated failure detection
- Integrate with OctoPrint/Klipper
Happy printing! 🖨️✨