Add set_color MQTT command handler for LED#37
Conversation
Receives color hex from middleware via spoolsense/<id>/cmd/set_color and sets the LED to that color. Used for UID-only tags where the color comes from Spoolman, not the tag itself.
|
Caution Review failedPull request was closed or merged during review Note
|
| Cohort / File(s) | Summary |
|---|---|
LED Color Control Integration src/HomeAssistantManager.cpp |
Added LEDManager.h include and implemented command interception for set_color command. Parses 6-character hex RGB payload using %2hhx%2hhx%2hhx format and calls LEDManager::showFilamentColor(r, g, b) with early return to bypass standard JSON parsing and command dispatch flow. |
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~10 minutes
🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. | |
| Description check | ❓ Inconclusive | The description covers the summary and test plan, but is missing the required Changes section listing specific modifications and does not fully address the Checklist requirements. | Add a Changes section detailing the specific modifications (e.g., modified HomeAssistantManager.cpp, added LEDManager.h include), and complete the Checklist section with hardware testing and compilation confirmations for both targets. |
✅ Passed checks (1 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title clearly and concisely summarizes the main change: adding a set_color MQTT command handler for LED control. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
📝 Generate docstrings
- Create stacked PR
- Commit on current branch
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Commit unit tests in branch
fix/uid-led-color
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
Summary
New
set_colorMQTT command handler in HomeAssistantManager. Receives a 6-character hex color string viaspoolsense/<device_id>/cmd/set_colorand sets the LED to that color.Used by the middleware for UID-only tags where the filament color comes from Spoolman, not from the tag itself. No tag needs to be present — the command is processed before the tag-present check.
Test plan
Paired with spoolsense_middleware PR #29
Summary by CodeRabbit