- Fix runtime_seconds never incrementing during prints
- Bug: first timestamp was set but never committed (updated_count was 0)
- Add needs_commit flag to ensure timestamp is saved on first iteration
Implement comprehensive theme customization with independent settings for
dark and light modes:
- Style layer: Classic (clean shadows), Glow (accent-colored glow effects),
Vibrant (dramatic deep shadows)
- Background layer: Neutral, Warm, Cool (light mode); plus OLED, Slate,
Forest (dark mode only)
- Accent colors: Green, Teal, Blue, Orange, Purple, Red
All combinations work independently (e.g., Glow + Forest + Teal). Settings
sync across devices via database and show toast confirmations on change.
Backend:
- Add 6 new settings fields (dark_style, dark_background, dark_accent,
light_style, light_background, light_accent)
- Add integration test for theme settings API
Frontend:
- Refactor index.css with 3-layer CSS variable system
- Update ThemeContext for dual-mode theme management
- Add Appearance section to Settings page with 6 dropdowns
- Update components for new ThemeContext API
- Virtual printer appears in Bambu Studio/Orca Slicer via SSDP discovery
- Secure TLS/MQTT communication with auto-generated certificates
- Queue mode (pending uploads) or auto-start mode
- Configurable access code for authentication
- Docker support with network_mode: host and certificate persistence
- Fix backup/restore for virtual printer settings (auto-save no longer overwrites)
- Add fuzzy color matching for filament comparison
Colors within RGB threshold of 40 are considered a match, fixing
cases where 3MF and printer report slightly different hex values
for the same filament color (e.g., beige #F5F5DC vs #FCECD6)
- Add POST /printers/{id}/refresh-status endpoint
Sends MQTT pushall command to request fresh AMS data from printer
- Improve Re-read button in filament check section
- Now triggers backend refresh before refetching status
- More prominent styling with text label and border
- 500ms delay after pushall to allow printer to respond
- Add AMS slot labels to matched filament display
Shows location like "PLA (AMS-B Slot 3)" instead of just "PLA"
- Add color hex tooltips on filament color circles
- Features:
- Tasmota device discovery: Auto-detect network and scan for Tasmota devices
in Add Smart Plug modal. Supports devices with/without authentication.
- Switchbar: Quick access widget in sidebar footer for controlling smart plugs
from anywhere in the app. Shows real-time status and power consumption.
- AMS Filament Preview:
- Add GET /archives/{id}/filament-requirements endpoint to extract
filament data from archived 3MF slice_info.config
- Show filament comparison in reprint modal when printer is selected
- Compare both filament type AND color with visual indicators:
- Green checkmark: Type and color match
- Yellow warning: Same type, different color
- Orange warning: Different type or empty slot
- Handle AMS-HT units (id >= 128) and virtual tray (slot 254)
- Normalize color formats between API (RRGGBBAA) and 3MF (#RRGGBB)
- File Type Badge:
- Archive cards show GCODE (green) or SOURCE (orange) badge
- Helps users identify which files have print data vs source-only
- Badge appears next to printer name in card content area
- Camera Stream Stability:
- Increase ffmpeg read timeout from 10s to 30s
- Add ffmpeg RTSP options: -timeout, -buffer_size, -max_delay
- Add frontend auto-reconnection with exponential backoff (2s-30s)
- Show reconnection UI with countdown and attempt counter
- Add TimelapseEditorModal component with visual timeline scrubber
- Add timelapse processing endpoints (info, thumbnails, process)
- Add TimelapseProcessor service using FFmpeg for video processing
- Support trim (start/end), speed (0.25x-4x), and audio overlay
- Add Edit button to TimelapseViewer
- Fix browser caching with timestamp query parameter
- Change default timelapse playback speed from 2x to 1x
- Detect Docker environment automatically via /.dockerenv and cgroup
- Show subnet input field in Add Printer dialog when running in Docker
- Scan IP range for Bambu printer ports (8883 MQTT, 990 FTPS)
- Query SSDP to get printer name/serial/model from discovered IPs
- Map raw SSDP model codes to friendly names (BL-P001→X1C, O1D→H2D)
1. "Unknown Status (255)" bug
File: backend/app/services/printer_manager.py:291-293
Problem: A1/P1 printers send stg_cur=255 when idle (unlike X1 which uses -1). The code treated 255 as a valid stage number and returned "Unknown stage (255)".
Fix: Changed the condition from if state.stg_cur >= 0: to if 0 <= state.stg_cur < 255: so that 255 is now treated as "no calibration stage" (same as -1).
2. AMS humidity/temp displaced on mobile
File: frontend/src/pages/PrintersPage.tsx:1164-1212
Problem: The AMS row used a rigid horizontal flex layout that didn't adapt to narrow mobile screens, causing humidity/temperature indicators to be displaced.
Fix:
- Added flex-wrap to allow wrapping on very narrow screens
- Added ml-auto to humidity/temp section to keep it right-aligned
- Added max-w-[60px] sm:max-w-none to truncate long filament names on mobile
- Changed gap from fixed gap-3 to responsive gap-2 sm:gap-3
Tests Added
4 new unit tests for get_derived_status_name:
- test_stg_cur_255_returns_none - Verifies A1/P1 idle state
- test_stg_cur_negative_one_returns_none_when_idle - Verifies X1 idle state
- test_valid_stage_returns_name - Verifies valid stages work
- test_stg_cur_zero_returns_printing - Verifies printing state
All 382 tests pass.
prints (not just completed), matching get_printer_total_hours behavior
- Add option to keep or delete archives when deleting a printer
- Custom maintenance types no longer auto-assign to all printers
- Add UI to manually assign/remove custom maintenance types per printer
- Add backend endpoints for assigning types to printers and removing items
- Exclude static/assets from large file pre-commit check
- Fix A1/P1 camera streaming with extended timeouts and lower FPS cap
prints (not just completed), matching get_printer_total_hours behavior
- Add option to keep or delete archives when deleting a printer
- Custom maintenance types no longer auto-assign to all printers
- Add UI to manually assign/remove custom maintenance types per printer
- Add backend endpoints for assigning types to printers and removing items
- Exclude static/assets from large file pre-commit check
- Use extruder_info[0].temp for right nozzle instead of nozzle_temper field which incorrectly mirrors left nozzle
- Gate dual nozzle parsing with has_h2d_extruder_info to prevent single nozzle printers showing two temps
- Add nozzle_heating calculation for single nozzle printers
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add getStatusDisplay() helper in frontend to format status nicely
- Add get_derived_status_name() in backend to compute status from:
- stg_cur calibration stages (bed leveling, vibration comp, etc.)
- Temperature data when stg_cur unavailable (heating heatbed/nozzle)
- Include stg_cur and stg_cur_name in WebSocket broadcasts
- Update broadcast status key to detect heating phase changes
Printer cards now show: "Heating heatbed", "Heating nozzle", "Preparing",
"Auto bed leveling", "Cleaning nozzle tip", and 60+ other stage names
instead of just "Printing" or "Idle".
Root cause: When a print completed with the camera stream popup open,
spawning a second ffmpeg process for finish photo capture caused a
conflict that froze the browser tab and video window.
Solution: Buffer the last frame from active camera streams. When
capturing finish photo, use the buffered frame if a stream is active
instead of spawning a new ffmpeg process.
Backend changes:
- camera.py: Added _last_frames buffer and get_buffered_frame() helper
- main.py: Photo capture uses buffered frame when stream is active
- main.py: Moved slow operations to background tasks (energy calc,
photo capture, smart plug, notifications, maintenance)
- archive.py: Fixed sync file write blocking event loop (asyncio.to_thread)
- printers.py: Added debug endpoint to simulate print completion
Frontend changes:
- useWebSocket.ts: Throttled printer status updates (100ms) to prevent
UI overload from rapid WebSocket messages
- useWebSocket.ts: Debounced archive invalidations (3s) to prevent
cascade of re-renders on print completion
- useWebSocket.test.ts: Updated tests for throttled/debounced handlers
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Backend (backend/app/api/routes/archives.py):
- Added filament_colors extraction from slice_info.config in 3MF files
- Maps filament IDs (1-based) to tool numbers (0-based)
Frontend (frontend/src/components/GcodeViewer.tsx):
1. Multi-color support: Pass extrusionColor as array of CSS color strings for multi-color prints
2. Bambu T-command filtering: Filter out special Bambu commands (T255, T1000, T1001, T65535, T65279) that corrupt tool state
3. Initial tool: Prepend T0 to ensure initial tool is set correctly
4. Disable gradient: Set disableGradient: true for multi-color to preserve actual filament colors (the gradient was turning black into gray/white)
5. Disable topLayerColor: Don't set topLayerColor for multi-color (it overrides per-tool colors)
Key fixes for Bambu G-code compatibility:
- Bambu uses special T commands (T1000, T65535, etc.) that aren't real tool changes
- The gcode-preview library's brightness gradient was modifying colors based on layer index
Commit message suggestion:
Add multi-color filament support to G-code viewer
- Extract filament colors from 3MF slice_info.config
- Pass color array to gcode-preview for tool-based coloring
- Filter Bambu special T commands (T1000, T65535, etc.)
- Disable gradient to preserve actual filament colors
- Replace manual error database with 853 codes from ha-bambulab
(Source: https://github.com/greghesp/ha-bambulab)
- Filter out unknown HMS error codes from display
(Printers sometimes send duplicate/undocumented codes for same error)
- Update HMS badge count to only show known errors
- Export filterKnownHMSErrors helper for reuse across components
- The failure analysis service was only querying status == "failed"
- Changed all queries to include both failed AND aborted: status.in_(["failed", "aborted"])
- File: backend/app/services/failure_analysis.py
Issue 2: Cannot clear failed flag in edit mode
- Added status field to ArchiveUpdate schema (backend)
- Added status to API client type (frontend)
- Added status dropdown to EditArchiveModal with options: Completed, Failed, Cancelled, Printing
- When status changes to "completed", failure_reason is automatically cleared
- File changes:
- backend/app/schemas/archive.py - added status field
- frontend/src/api/client.ts - added status to updateArchive type
- frontend/src/components/EditArchiveModal.tsx - added status dropdown
- H2D sends timelapse status in ipcam.timelapse field, not xcam.timelapse
- Added parsing for timelapse from ipcam data
- Added test to prevent regression
2. Systemd service updated - /etc/systemd/system/bambuddy.service
- Now runs as claude user instead of root
- Added ExecStartPre commands with + prefix (runs as root) to:
- Create logs and archive directories if missing
- Fix ownership to claude:claude before service starts
The service restarted successfully with the permission fixes running at startup. On the next print with timelapse enabled, both the snapshot and timelapse should be captured automatically.
1. bambu_mqtt.py: Added hms_errors to the completion callback data, which includes the HMS error codes when a print fails
2. archive.py: Updated update_archive_status() to accept an optional failure_reason parameter
3. main.py: Added auto-detection of failure reasons:
- status == "aborted" → failure_reason = "User cancelled"
- status == "failed" with HMS errors → maps module codes to reasons:
- Module 0x07 (Filament) → "Filament runout"
- Module 0x0C (Motion Controller) → "Layer shift"
- Module 0x05 (Nozzle) → "Clogged nozzle"
Frontend changes:
1. ArchivesPage.tsx:
- Badge now shows "cancelled" for aborted prints, "failed" for failed prints
- "Failed Prints" collection and "Hide Failed" filter now include both failed and aborted statuses
2. EditArchiveModal.tsx: Failure reason field now shows for both failed and aborted prints
New tests added:
- test_hms_errors_included_in_failed_completion_callback
- test_aborted_status_when_cancelled
The HMS error module mapping is basic and can be expanded as you observe more failure types. The actual Bambu HMS error codes are documented in their wiki - we can add
more mappings as needed.
Problem: xcam data was parsed BEFORE _was_running was set to True, so timelapse detection failed when both arrived in the same message.
Fix: Added timelapse detection at two critical points:
# Lines 1375-1381: When entering RUNNING state
if self.state.state == "RUNNING" and current_file:
if not self._was_running:
if self.state.timelapse:
self._timelapse_during_print = True
logger.info(f"[{self.serial_number}] Timelapse detected when entering RUNNING state")
# Lines 1391-1399: When print start detected
if self.state.timelapse:
self._timelapse_during_print = True
logger.info(f"[{self.serial_number}] Timelapse detected at print start")
2. Callback Error Handling (main.py + printer_manager.py)
Problem: The on_print_complete callback was hanging silently - no logs after "Found archive".
Fixes:
- Added try/except wrapper around "Update archive status" section (line 749-767)
- Added [CALLBACK] log messages at start and end of callback
- Added exception handler to _schedule_async in printer_manager.py to log any exceptions from async callbacks
3. New Integration Tests (test_bambu_mqtt.py)
Added TestRealisticMessageFlow class with 5 new tests that simulate real MQTT message sequences:
1. test_timelapse_detected_at_print_start_in_same_message - The critical race condition test
2. test_timelapse_not_detected_when_disabled
3. test_timelapse_detected_when_enabled_after_print_start
4. test_print_complete_includes_timelapse_flag_full_flow - Full lifecycle test
5. test_print_failed_includes_timelapse_flag
These tests process messages through _process_message() with proper {"print": {...}} wrapping, matching real MQTT flow.
Files Modified:
- backend/app/services/bambu_mqtt.py - Timelapse race condition fix
- backend/app/main.py - Error handling + logging for on_print_complete
- backend/app/services/printer_manager.py - Exception capture in _schedule_async
- backend/tests/unit/services/test_bambu_mqtt.py - New integration tests
Next Steps
You should restart the application to apply these changes. The next print will show:
- [CALLBACK] on_print_complete started for printer X
- [ARCHIVE] Updating archive X status...
- [ENERGY], [PHOTO], [AUTO-OFF] logs (if those features trigger)
- [CALLBACK] on_print_complete finished for printer X, archive X
Problem: At print start, the MQTT mc_remaining_time was often 0 or unavailable because the printer hadn't fully processed the gcode yet.
Solution: Modified the notification system to prioritize the print_time_seconds from the 3MF file parsing (which is always available after archive creation) over the
MQTT remaining time.
Files changed:
- backend/app/services/notification_service.py:
- Added optional archive_data parameter to on_print_start() method
- Added priority logic: archive data > MQTT remaining_time > raw_data mc_remaining_time
- backend/app/main.py:
- Created _send_print_start_notification() helper function
- Moved notification sending to AFTER archive creation (when print_time_seconds is available)
- Added fallback notification sending at early return points (auto_archive disabled, file not found, etc.)
Issue 2: Timelapse Auto-Assignment
Problem: Timelapses couldn't be auto-assigned reliably because printer dates could be off in LAN-only mode, making timestamp matching unreliable.
Solution: Track whether timelapse recording was active during the print via MQTT, and if so, auto-fetch the most recent timelapse file on print completion.
Files changed:
- backend/app/services/bambu_mqtt.py:
- Added _timelapse_during_print instance variable
- Track when timelapse is active during a print (in both data and xcam parsing)
- Reset the flag on new print start
- Include timelapse_was_active in the print complete callback data
- backend/app/main.py:
- Added timelapse auto-scan logic in on_print_complete()
- If timelapse_was_active is True and status is "completed":
- Wait 5 seconds for timelapse to finalize
- Scan printer's timelapse directory
- Find most recent file by mtime
- Verify it was modified within 30 minutes of print completion
- Download and attach to archive
- Send WebSocket update
- Separate AMS and AMS-HT notification switches (one per device type)
- Fix notification variables not showing (duration, filament, estimated_time)
- Add fallback values for empty notification variables ("Unknown" instead of blank)
Settings:
- Fix API keys badge count only showing after visiting tab
- Move External Links card to third column above Updates
- Add Release Notes modal for viewing full notes before updating
Statistics:
- Fix filament usage trends not showing (wrong API parameters)
- Move dashboard controls (Hidden, Reset Layout) to header row
- Remove duplicate Reset Layout button
Camera:
- Fix ffmpeg processes not killed when closing webcam window
- Add /camera/stop endpoint with POST support for sendBeacon
- Track active streams and proper cleanup on disconnect