[PR #253] [MERGED] Add camera image attachments to Pushover notifications #975

Closed
opened 2026-05-06 12:34:17 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/maziggy/bambuddy/pull/253
Author: @sbcrumb
Created: 2/3/2026
Status: Merged
Merged: 2/4/2026
Merged by: @maziggy

Base: 0.1.8bHead: feature/pushover-image-attachments


📝 Commits (2)

  • 6aa7a56 Add camera image attachments to Pushover notifications
  • 925cc13 Merge branch '0.1.8b' into feature/pushover-image-attachments

📊 Changes

3 files changed (+219 additions, -58 deletions)

View changed files

📝 backend/app/main.py (+107 -3)
📝 backend/app/services/camera.py (+62 -44)
📝 backend/app/services/notification_service.py (+50 -11)

📄 Description

Description

Add camera image attachments to Pushover notifications. When a notification is sent via Pushover for print start, print complete/failed/stopped, progress milestones (25%, 50%, 75%), or printer errors, a camera snapshot is captured and attached as a native Pushover image.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Test addition or update

Changes Made

  • Added capture_camera_frame_bytes() to camera.py that returns raw JPEG bytes without writing to disk (supports both chamber image and RTSP protocols)
  • Added _capture_snapshot_for_notification() helper to main.py that captures a camera snapshot using external camera, buffered stream frame, or fresh capture (same priority as finish photo)
  • Threaded optional image_data parameter through the notification pipeline (_send_to_providers_send_to_provider_send_pushover) — all default to None so existing behavior is unchanged
  • Updated _send_pushover() to send multipart form-data with image attachment when image_data is provided
  • Added snapshot capture to print start, progress milestone, and printer error call sites in main.py
  • Read finish photo bytes from disk in _background_notifications() for print complete/failed/stopped events
  • Image attachments respect Pushover's 2.5MB size limit and fail gracefully (notification still sends as text-only if capture fails)

Screenshots

Start of Print

Screenshot_2026-02-03-14-14-12-85_b0dee7ef33e01af84433b30b99d6e2f9

Progress Screenshot

Screenshot_2026-02-03-14-52-04-55_b0dee7ef33e01af84433b30b99d6e2f9

Finish Screenshot

Screenshot_2026-02-04-09-17-51-76_b0dee7ef33e01af84433b30b99d6e2f9

Testing

  • I have tested this on my local machine
  • I have tested with my printer model: H2S

Built Docker image from fork, deployed, and verified:

  • Print start notification arrives with camera snapshot attached
  • Progress milestone notifications arrive with camera snapshot attached
  • Print complete notification arrives with finish photo attached
  • Printer error notifications arrive with camera snapshot attached
  • Other notification providers (Discord, Telegram, etc.) are unaffected
  • Notifications still send as text-only when camera is unavailable

Checklist

  • My code follows the project's coding style
  • I have commented my code where necessary
  • I have updated the documentation (if needed)
  • My changes generate no new warnings
  • I have tested my changes thoroughly

Additional Notes

  • Only Pushover receives image attachments currently. The image_data parameter is threaded through the shared pipeline, so other providers (Discord, Telegram, ntfy) could adopt it in the future with minimal changes.
  • Camera snapshot capture for error notifications is done once and reused across multiple errors to avoid hitting the camera repeatedly.
  • All new parameters default to None, so there are zero behavioral changes for non-Pushover providers or events that don't capture images.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/maziggy/bambuddy/pull/253 **Author:** [@sbcrumb](https://github.com/sbcrumb) **Created:** 2/3/2026 **Status:** ✅ Merged **Merged:** 2/4/2026 **Merged by:** [@maziggy](https://github.com/maziggy) **Base:** `0.1.8b` ← **Head:** `feature/pushover-image-attachments` --- ### 📝 Commits (2) - [`6aa7a56`](https://github.com/maziggy/bambuddy/commit/6aa7a560d81245077ed82f11a39a1cb4a661d6f6) Add camera image attachments to Pushover notifications - [`925cc13`](https://github.com/maziggy/bambuddy/commit/925cc136695f3fb5753ae9bcb16321b4db383919) Merge branch '0.1.8b' into feature/pushover-image-attachments ### 📊 Changes **3 files changed** (+219 additions, -58 deletions) <details> <summary>View changed files</summary> 📝 `backend/app/main.py` (+107 -3) 📝 `backend/app/services/camera.py` (+62 -44) 📝 `backend/app/services/notification_service.py` (+50 -11) </details> ### 📄 Description ## Description Add camera image attachments to Pushover notifications. When a notification is sent via Pushover for print start, print complete/failed/stopped, progress milestones (25%, 50%, 75%), or printer errors, a camera snapshot is captured and attached as a native Pushover image. ## Related Issue <!-- No existing issue --> ## Type of Change - [ ] Bug fix (non-breaking change that fixes an issue) - [x] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [ ] Code refactoring - [ ] Performance improvement - [ ] Test addition or update ## Changes Made - Added `capture_camera_frame_bytes()` to `camera.py` that returns raw JPEG bytes without writing to disk (supports both chamber image and RTSP protocols) - Added `_capture_snapshot_for_notification()` helper to `main.py` that captures a camera snapshot using external camera, buffered stream frame, or fresh capture (same priority as finish photo) - Threaded optional `image_data` parameter through the notification pipeline (`_send_to_providers` → `_send_to_provider` → `_send_pushover`) — all default to `None` so existing behavior is unchanged - Updated `_send_pushover()` to send multipart form-data with image attachment when `image_data` is provided - Added snapshot capture to print start, progress milestone, and printer error call sites in `main.py` - Read finish photo bytes from disk in `_background_notifications()` for print complete/failed/stopped events - Image attachments respect Pushover's 2.5MB size limit and fail gracefully (notification still sends as text-only if capture fails) ## Screenshots Start of Print ![Screenshot_2026-02-03-14-14-12-85_b0dee7ef33e01af84433b30b99d6e2f9](https://github.com/user-attachments/assets/d0e63b6e-e13e-4b02-be0e-6ee913b70b50) Progress Screenshot ![Screenshot_2026-02-03-14-52-04-55_b0dee7ef33e01af84433b30b99d6e2f9](https://github.com/user-attachments/assets/5e7c9e3b-1831-46c1-9aa9-9deeca0c503d) Finish Screenshot ![Screenshot_2026-02-04-09-17-51-76_b0dee7ef33e01af84433b30b99d6e2f9](https://github.com/user-attachments/assets/5c2b690b-679d-4d35-9283-da89bc5bbc9b) ## Testing - [x] I have tested this on my local machine - [ ] I have tested with my printer model: H2S Built Docker image from fork, deployed, and verified: - Print start notification arrives with camera snapshot attached - Progress milestone notifications arrive with camera snapshot attached - Print complete notification arrives with finish photo attached - Printer error notifications arrive with camera snapshot attached - Other notification providers (Discord, Telegram, etc.) are unaffected - Notifications still send as text-only when camera is unavailable ## Checklist - [x] My code follows the project's coding style - [x] I have commented my code where necessary - [ ] I have updated the documentation (if needed) - [x] My changes generate no new warnings - [x] I have tested my changes thoroughly ## Additional Notes - Only Pushover receives image attachments currently. The `image_data` parameter is threaded through the shared pipeline, so other providers (Discord, Telegram, ntfy) could adopt it in the future with minimal changes. - Camera snapshot capture for error notifications is done once and reused across multiple errors to avoid hitting the camera repeatedly. - All new parameters default to `None`, so there are zero behavioral changes for non-Pushover providers or events that don't capture images. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 12:34:17 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/bambuddy#975
No description provided.