mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-05-09 00:08:34 +02:00
[GH-ISSUE #1220] [Feature]: Assign last scanned NFC spool to the next AMS slot that becomes occupied #886
Labels
No labels
A1
automated
automated
bug
bug
Closed due to inactivity
contrib
dependencies
dependencies
duplicate
enhancement
feedback
hold
invalid
Notes
P1S
pull-request
security
ThumbsUp
user-report
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/bambuddy-maziggy-1#886
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @MiguelAngelLV on GitHub (May 6, 2026).
Original GitHub issue: https://github.com/maziggy/bambuddy/issues/1220
Problem or Use Case
Summary
Add an API endpoint that accepts an NFC tag scan (tag UID / tray UUID) and automatically assigns the corresponding inventory spool to the next AMS slot that transitions from empty to occupied, for a specified printer. This enables a “scan → insert spool → auto-configure that slot” workflow.
Problem / Motivation
Today, the SpoolBuddy NFC flow (
POST /nfc/tag-scanned) only detects/matches a spool and broadcasts websocket events for the UI, but it does not perform any automatic assignment to an AMS slot. Assignment is manual via the UI (select AMS + tray).For kiosk/production setups, the desired workflow is:
This should work regardless of what the printer reports in that slot’s filament metadata, and should rely on the physical slot transition (empty → occupied).
Proposed Solution
Proposed API
Add a dedicated endpoint, e.g.:
POST /spoolbuddy/nfc/assign-next-slot(or under existing SpoolBuddy routes:
POST /nfc/assign-next-slot)Request (example)
Response (example)
Expected Behavior
When this endpoint is called:
Match the spool from inventory using the provided NFC data (same matching rules as current tag-scanned flow: tray_uuid preferred, fallback to tag_uid matching).
Store a pending “assignment intent” for that printer (and optionally for that device_id):
spool_id.”Listen for AMS updates for that specific printer (the same AMS change events already processed via MQTT).
When any AMS slot transitions:
empty(no tray_type / no spool present)occupied(tray_type present / spool inserted)then assign that slot to the pending spool:
SpoolAssignmentfor(printer_id, ams_id, tray_id)with the matched spoolPOST /inventory/assignmentsso it sets filament settings consistently)Once assigned, clear the pending intent and return success (or if the endpoint is asynchronous, broadcast a websocket event).
Important Requirements / Notes
printer_id(preferably required) to avoid ambiguity in multi-printer setups.timeout_seconds, return an error like409 Conflict/408 Request Timeout/202 Accepteddepending on implementation choice.Suggested WebSocket Events (optional but helpful)
spoolbuddy_pending_assignment_created(printer_id, spool_id, expires_at)spoolbuddy_pending_assignment_timeoutspoolbuddy_pending_assignment_completed(printer_id, ams_id, tray_id, spool_id)Acceptance Criteria
SpoolAssignmentfor that slotWhy this is valuable
This feature enables a “hands-free” workflow for workshops/farms: operators can scan a spool and insert it into AMS without touching the UI, reducing errors and speeding up spool changes.
Alternatives Considered
No response
Feature Category
API
Priority
Would improve my workflow
Mockups or Examples
No response
Contribution
Checklist