[PR #272] [CLOSED] AMS Lite to Spoolman #981

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

📋 Pull Request Information

Original PR: https://github.com/maziggy/bambuddy/pull/272
Author: @adrilop002
Created: 2/4/2026
Status: Closed

Base: 0.1.8bHead: feature/spoolman-etl


📝 Commits (6)

  • 192f0f7 Add spool ETL script and Spoolman sync
  • a179df2 Merge branch '0.1.8b' into feature/spoolman-etl
  • 3abc602 Merge branch '0.1.8b' into feature/spoolman-etl
  • fd8697d Merge branch '0.1.8b' into feature/spoolman-etl
  • bbb1f2f Update bambuddy_etl_spools.sh
  • c3aa612 Merge branch '0.1.8b' into feature/spoolman-etl

📊 Changes

1 file changed (+586 additions, -0 deletions)

View changed files

scripts/bambuddy_etl_spools.sh (+586 -0)

📄 Description

Description

Adds a new helper script scripts/bambuddy_etl_spools.sh to extract filament usage from bambuddy.db into a local tracking.db, generate CSV summaries, and (optionally) sync spool remaining weight to Spoolman.

The script is designed to be safe for repeated runs and uses INSERT OR IGNORE to avoid duplicates. It also warns if spoolman_map (tag_uid -> spool_id) mappings are missing, and only syncs mapped spools.

Fixes #

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 scripts/bambuddy_etl_spools.sh to ingest print archive data into tracking.db and generate:
  • out/filamento_por_color.csv
  • out/filamento_por_bobina.csv (includes spool color name, dominant filament type, and optional spool_id)
  • Added basic color mapping (color_map) and spool mapping table (spoolman_map) support.

  • Added Spoolman sync: PATCH /api/v1/spool/{spool_id} updating remaining_weight (overwrite mode), with fail-soft behavior and logging to out/spoolman_push.log. (remaining_weight and used_weight are not set together.)

Screenshots

Testing

Ran ./scripts/bambuddy_etl_spools.sh against a real bambuddy.db and verified generated CSV output.

Confirmed Spoolman updates by checking the remaining weight values after running the script.

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

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


🔄 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/272 **Author:** [@adrilop002](https://github.com/adrilop002) **Created:** 2/4/2026 **Status:** ❌ Closed **Base:** `0.1.8b` ← **Head:** `feature/spoolman-etl` --- ### 📝 Commits (6) - [`192f0f7`](https://github.com/maziggy/bambuddy/commit/192f0f76a424ea7118255a0ec73684d6cb065166) Add spool ETL script and Spoolman sync - [`a179df2`](https://github.com/maziggy/bambuddy/commit/a179df2fb059b249246781b584b8218ba005ce26) Merge branch '0.1.8b' into feature/spoolman-etl - [`3abc602`](https://github.com/maziggy/bambuddy/commit/3abc602708105ca4a52e97aab2b4830afac5d7bd) Merge branch '0.1.8b' into feature/spoolman-etl - [`fd8697d`](https://github.com/maziggy/bambuddy/commit/fd8697d304c24a05556ef7cc3ea2f138dfe05fd7) Merge branch '0.1.8b' into feature/spoolman-etl - [`bbb1f2f`](https://github.com/maziggy/bambuddy/commit/bbb1f2fcbc4a195ff31a7cb3dfea3cf4afa155ca) Update bambuddy_etl_spools.sh - [`c3aa612`](https://github.com/maziggy/bambuddy/commit/c3aa612c011439722aa485991358474128a769ff) Merge branch '0.1.8b' into feature/spoolman-etl ### 📊 Changes **1 file changed** (+586 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `scripts/bambuddy_etl_spools.sh` (+586 -0) </details> ### 📄 Description ## Description Adds a new helper script scripts/bambuddy_etl_spools.sh to extract filament usage from bambuddy.db into a local tracking.db, generate CSV summaries, and (optionally) sync spool remaining weight to Spoolman. The script is designed to be safe for repeated runs and uses INSERT OR IGNORE to avoid duplicates. It also warns if spoolman_map (tag_uid -> spool_id) mappings are missing, and only syncs mapped spools. ## Related Issue <!-- Link to the issue this PR addresses (if applicable) --> Fixes # ## Type of Change <!-- Mark the relevant option with an "x" --> - [ ] 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 scripts/bambuddy_etl_spools.sh to ingest print archive data into tracking.db and generate: - out/filamento_por_color.csv - out/filamento_por_bobina.csv (includes spool color name, dominant filament type, and optional spool_id) * Added basic color mapping (color_map) and spool mapping table (spoolman_map) support. * Added Spoolman sync: PATCH /api/v1/spool/{spool_id} updating remaining_weight (overwrite mode), with fail-soft behavior and logging to out/spoolman_push.log. (remaining_weight and used_weight are not set together.) ## Screenshots <!-- If applicable, add screenshots to demonstrate your changes --> ## Testing Ran ./scripts/bambuddy_etl_spools.sh against a real bambuddy.db and verified generated CSV output. Confirmed Spoolman updates by checking the remaining weight values after running the script. - [ ] I have tested this on my local machine - [ ] I have tested with my printer model: <!-- e.g., X1C, P1S, A1 --> ## 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 <!-- Add any additional information that reviewers should know --> --- <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:19 +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#981
No description provided.