1
0
Fork 0
mirror of https://github.com/maziggy/bambuddy.git synced 2026-05-09 08:25:54 +02:00

[PR #1187] [CLOSED] fix: wire up fan speed controls end-to-end #1179

Closed
opened 2026-05-07 00:16:29 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/maziggy/bambuddy/pull/1187
Author: @e77
Created: 5/1/2026
Status: Closed

Base: mainHead: fix/fan-speed-controls


📝 Commits (4)

  • e55d569 fix: wire up fan speed controls end-to-end
  • 5775ed1 add Dockerfile.preview and compose for remote preview build
  • a5058eb preview compose: host networking + NET_BIND_SERVICE for printer access
  • 9a51696 remove preview-only build files

📊 Changes

3 files changed (+217 additions, -24 deletions)

View changed files

📝 backend/app/api/routes/printers.py (+31 -0)
📝 frontend/src/api/client.ts (+6 -0)
📝 frontend/src/pages/PrintersPage.tsx (+180 -24)

📄 Description

Description

Fan badges in the printer controls section displayed speed from MQTT status but had no interactivity — clicking them did nothing. The MQTT set_fan_speed() method (M106 P{fan} S{speed}) already existed in bambu_mqtt.py but was not exposed.

Changes:

  • backend: add POST /{printer_id}/fan-speed?fan={1-3}&speed={0-255} endpoint in printers.py, matching the pattern of existing controls (print-speed, chamber-light, airduct-mode)
  • frontend/api: add setFanSpeed() client call
  • frontend/ui: convert the three read-only fan badges (part cooling, auxiliary, chamber) into clickable buttons that open a popover with an ON/OFF toggle and a 0-100% slider (5% steps, fires on pointer-up) with optimistic updates and error rollback

Fans are controllable at any time (not gated on print state).

Documentation

Companion docs PRs (delete lines that don't apply):

  • Wiki: maziggy/bambuddy-wiki#___
  • Website: maziggy/bambuddy-website#___

Pick one:

  • Docs PR(s) linked above
  • No docs update required — reason: ___ Minor change to existing features

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

  • backend: add POST /{printer_id}/fan-speed?fan={1-3}&speed={0-255} endpoint in printers.py, matching the pattern of existing controls (print-speed, chamber-light, airduct-mode)
  • frontend/api: add setFanSpeed() client call
  • frontend/ui: convert the three read-only fan badges (part cooling, auxiliary, chamber) into clickable buttons that open a popover with an ON/OFF toggle and a 0-100% slider (5% steps, fires on pointer-up) with optimistic updates and error rollback

Fans are controllable at any time (not gated on print state).

Screenshots

image image image

Testing

  • [x ] I have tested this on my local machine
  • [ x] I have tested with my printer model: P2S

Checklist

  • [x ] My code follows the project's coding style
  • [ x] I have commented my code where necessary
  • [x ] My changes generate no new warnings
  • [x ] I have tested my changes thoroughly

🔄 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/1187 **Author:** [@e77](https://github.com/e77) **Created:** 5/1/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/fan-speed-controls` --- ### 📝 Commits (4) - [`e55d569`](https://github.com/maziggy/bambuddy/commit/e55d56960b78249ad44b086ac87d388b886e5853) fix: wire up fan speed controls end-to-end - [`5775ed1`](https://github.com/maziggy/bambuddy/commit/5775ed145dcca7919e5e1049754ac84e3beda5ef) add Dockerfile.preview and compose for remote preview build - [`a5058eb`](https://github.com/maziggy/bambuddy/commit/a5058ebe92e5573c2c58ddfe6e644c5d89ad6722) preview compose: host networking + NET_BIND_SERVICE for printer access - [`9a51696`](https://github.com/maziggy/bambuddy/commit/9a51696fdae4bf12e9cce32626613ee1ae0f8b8b) remove preview-only build files ### 📊 Changes **3 files changed** (+217 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `backend/app/api/routes/printers.py` (+31 -0) 📝 `frontend/src/api/client.ts` (+6 -0) 📝 `frontend/src/pages/PrintersPage.tsx` (+180 -24) </details> ### 📄 Description ## Description Fan badges in the printer controls section displayed speed from MQTT status but had no interactivity — clicking them did nothing. The MQTT set_fan_speed() method (M106 P{fan} S{speed}) already existed in bambu_mqtt.py but was not exposed. Changes: - backend: add POST /{printer_id}/fan-speed?fan={1-3}&speed={0-255} endpoint in printers.py, matching the pattern of existing controls (print-speed, chamber-light, airduct-mode) - frontend/api: add setFanSpeed() client call - frontend/ui: convert the three read-only fan badges (part cooling, auxiliary, chamber) into clickable buttons that open a popover with an ON/OFF toggle and a 0-100% slider (5% steps, fires on pointer-up) with optimistic updates and error rollback Fans are controllable at any time (not gated on print state). ## Related Issue <!-- Link to the issue this PR addresses (if applicable) --> ## Documentation <!-- If this PR changes user-visible behavior, config keys, ports, CLI flags, URLs, or installation steps, link matching PRs in the docs repos below. Internal refactors, bug fixes with no observable change, and test-only changes are exempt — just check the "not required" box and say why. See CONTRIBUTING.md → Documentation Requirements for the full rules. --> **Companion docs PRs** (delete lines that don't apply): - Wiki: maziggy/bambuddy-wiki#___ - Website: maziggy/bambuddy-website#___ **Pick one**: - [ ] Docs PR(s) linked above - [x] No docs update required — reason: ___ Minor change to existing features ## Type of Change <!-- Mark the relevant option with an "x" --> - [ ] 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 <!-- List the specific changes made in this PR --> - backend: add POST /{printer_id}/fan-speed?fan={1-3}&speed={0-255} endpoint in printers.py, matching the pattern of existing controls (print-speed, chamber-light, airduct-mode) - frontend/api: add setFanSpeed() client call - frontend/ui: convert the three read-only fan badges (part cooling, auxiliary, chamber) into clickable buttons that open a popover with an ON/OFF toggle and a 0-100% slider (5% steps, fires on pointer-up) with optimistic updates and error rollback Fans are controllable at any time (not gated on print state). ## Screenshots <img width="274" height="159" alt="image" src="https://github.com/user-attachments/assets/b3dce18d-5a31-460e-a52b-3e390be72eb8" /> <img width="438" height="147" alt="image" src="https://github.com/user-attachments/assets/870a12f3-a549-4a92-aa8c-4afcfc5f2cce" /> <img width="466" height="144" alt="image" src="https://github.com/user-attachments/assets/d5422150-a24d-404e-8847-ad0a09657337" /> <!-- If applicable, add screenshots to demonstrate your changes --> ## Testing <!-- Describe how you tested your changes --> - [x ] I have tested this on my local machine - [ x] I have tested with my printer model: P2S<!-- e.g., X1C, P1S, A1 --> ## Checklist - [x ] My code follows the project's coding style - [ x] I have commented my code where necessary - [x ] My changes generate no new warnings - [x ] I have tested my changes thoroughly --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-07 00:16:29 +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-maziggy-1#1179
No description provided.