Enhanced Locations: Hierarchy, Custom Fields, QR Labels #9

Closed
opened 2026-01-15 03:00:46 +00:00 by tonym · 0 comments
Owner

Summary

Comprehensive improvements to the location system: hierarchical structure, custom fields, QR code labels, and drybox management.

Upstream Issues

Features

1. Hierarchical Locations (Room → Shelf → Bin)

Allow nested location structure:

Office
  └── Shelf A
        ├── Bin 1
        └── Bin 2
  └── Shelf B
Garage
  └── Dry Box 1
  └── Dry Box 2

Implementation:

  • Add parent_id foreign key to Location model
  • UI: tree view or breadcrumb navigation
  • Spool can be assigned to any level (room, shelf, or bin)

2. Custom Fields for Locations

Track environmental data at location level (not per-spool):

  • Temperature
  • Humidity
  • Custom fields (like spools/filaments already have)

Use case: Sync Home Assistant sensors to dryer box locations.

Implementation:

  • Add LocationField table (like SpoolField, FilamentField)
  • API endpoints for custom field CRUD

3. QR Code Labels for Locations

Print QR labels for bins/shelves/dryboxes:

  • QR links to /location/show/{id} or filtered spool list
  • Template shows: location name, path (Office > Shelf A > Bin 1)
  • Scan to see all spools in that location

Implementation:

  • Add location label printing (similar to spool/filament labels)
  • Reuse existing QR label components
  • Location-specific template variables

4. Drybox Labels (Dynamic Content)

For single-spool locations like dryboxes:

  • Label on drybox shows CURRENT spool inside
  • Updates when spool is moved
  • Options:
    • A) QR links to location → shows current spool
    • B) E-ink display integration (future)
    • C) Print new label when spool changes

5. Exclusive Location Validation

  • Mark locations as "single spool only" (drybox mode)
  • Prevent assigning multiple spools to same exclusive location
  • Warning if spool already assigned elsewhere

Database Changes

class Location(Base):
    id: int
    name: str
    parent_id: Optional[int]  # NEW - for hierarchy
    is_exclusive: bool = False  # NEW - single spool only
    # existing fields...

class LocationField(Base):  # NEW
    id: int
    location_id: int
    key: str
    value: str

UI Changes

  • Location list: show as tree or flat with breadcrumbs
  • Location create/edit: parent selector dropdown, exclusive checkbox
  • Location detail: show child locations, custom fields, current spool(s)
  • Print labels button on location pages
## Summary Comprehensive improvements to the location system: hierarchical structure, custom fields, QR code labels, and drybox management. ## Upstream Issues - https://github.com/Donkie/Spoolman/issues/763 - Custom fields for locations (temp/humidity sensors) - https://github.com/Donkie/Spoolman/issues/90 (8 comments) - Location labels for dryboxes ## Features ### 1. Hierarchical Locations (Room → Shelf → Bin) Allow nested location structure: ``` Office └── Shelf A ├── Bin 1 └── Bin 2 └── Shelf B Garage └── Dry Box 1 └── Dry Box 2 ``` **Implementation:** - Add `parent_id` foreign key to Location model - UI: tree view or breadcrumb navigation - Spool can be assigned to any level (room, shelf, or bin) ### 2. Custom Fields for Locations Track environmental data at location level (not per-spool): - Temperature - Humidity - Custom fields (like spools/filaments already have) **Use case:** Sync Home Assistant sensors to dryer box locations. **Implementation:** - Add LocationField table (like SpoolField, FilamentField) - API endpoints for custom field CRUD ### 3. QR Code Labels for Locations Print QR labels for bins/shelves/dryboxes: - QR links to `/location/show/{id}` or filtered spool list - Template shows: location name, path (Office > Shelf A > Bin 1) - Scan to see all spools in that location **Implementation:** - Add location label printing (similar to spool/filament labels) - Reuse existing QR label components - Location-specific template variables ### 4. Drybox Labels (Dynamic Content) For single-spool locations like dryboxes: - Label on drybox shows CURRENT spool inside - Updates when spool is moved - Options: - A) QR links to location → shows current spool - B) E-ink display integration (future) - C) Print new label when spool changes ### 5. Exclusive Location Validation - Mark locations as "single spool only" (drybox mode) - Prevent assigning multiple spools to same exclusive location - Warning if spool already assigned elsewhere ## Database Changes ```python class Location(Base): id: int name: str parent_id: Optional[int] # NEW - for hierarchy is_exclusive: bool = False # NEW - single spool only # existing fields... class LocationField(Base): # NEW id: int location_id: int key: str value: str ``` ## UI Changes - Location list: show as tree or flat with breadcrumbs - Location create/edit: parent selector dropdown, exclusive checkbox - Location detail: show child locations, custom fields, current spool(s) - Print labels button on location pages
tonym changed title from Hierarchical Location Support (Room/Bin) to Enhanced Locations: Hierarchy, Custom Fields, QR Labels 2026-01-16 04:28:49 +00:00
tonym closed this issue 2026-01-23 03:03:23 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: tonym/spoolman2#9
No description provided.