SpoolmanSync - Automatic Filament Tracking for Bambu Lab Printers (Beginner Friendly!)

:tada: SpoolmanSync - Automatic Filament Tracking for Bambu Lab Printers

Hey everyone! I’m excited to share a project I’ve been working on: SpoolmanSync - a web app that automatically tracks your filament usage from Bambu Lab printers and
syncs it with Spoolman.

:thinking: What does it do?

Ever finish a print and wonder “how much filament is actually left on that spool?” SpoolmanSync solves this by automatically deducting filament usage from your Spoolman
inventory whenever a print completes. No manual logging required!

Key features:

  • :printer: Automatic filament usage tracking when prints finish
  • :bar_chart: Real-time dashboard showing your AMS trays and assigned spools
  • :art: Works with ANY filament brand - not just Bambu spools (Polymaker, Hatchbox, eSUN, etc.)
  • :arrows_counterclockwise: Supports AMS tray changes mid-print
  • :electric_plug: External spool holder support

:house: Home Assistant Integration

This project leverages:

:rocket: Beginner-Friendly Setup

I wanted this to be accessible to everyone, not just HA power users. So there are two deployment modes:

Embedded Mode (Easiest)

  • Bundles a pre-configured Home Assistant container with HACS and ha-bambulab already installed
  • One-click automation deployment - generates the proper automation.yaml and configuration.yaml based on YOUR specific printer, AMS units, and trays
  • Login via Bambu Cloud for easy printer setup
  • No YAML editing required!

External Mode

  • Connect to your existing Home Assistant instance via OAuth
  • Copy the generated YAML configs to your setup
  • Full control for advanced users

:clipboard: Requirements

  • Docker & Docker Compose
  • A Bambu Lab printer (X1C, P1S, etc.) with optional AMS
  • A running Spoolman instance (SpoolmanSync does NOT include Spoolman)

:camera_flash: Screenshot

:link: Links

GitHub: GitHub - gibz104/SpoolmanSync: Sync Bambu Lab AMS trays with Spoolman for automatic filament tracking


Would love to hear your feedback, feature requests, or bug reports! This is still a young project so there’s plenty of room to grow. :seedling:

Happy printing! :printer::sparkles:

2 Likes

Looks good, pretty similar to SpoolmanUpdater but without the hustle of creating your own yamls.
But one thing: Could you provide pre-built Docker images on e.g. GitHub Container Registry? This would make deployment much easier, especially for NAS users.

1 Like

Thanks! Yes, SpoolmanUpdater was my inspiration, but I wanted to eliminate the manual configuration entirely. With SpoolmanSync, there’s no YAML editing and no Home Assistant expertise required - everything is configured through the web UI. The embedded mode bundles a pre-configured Home Assistant, so you just log in with your Bambu Cloud credentials and connect to Spoolman. It also includes QR code scanning for quick spool assignments. I built it in TypeScript/Next.js to hopefully be more contributor friendly.

I’ve just published the pre-built images to both GitHub Container Registry and Docker Hub. One image contains the SpoolmanSync app and the other image contains Home Assistant with HACS and ha-bambulab pre-installed. There is also a new docker-compose.prebuilt.yml file that can be downloaded on a NAS, which uses the pre-built images.

Let me know if you have any other suggestions!

Thanks so much for the quick response and providing the pre-built images.
Really appreciated!

I actually do have Home Assistant with ha-bambulab already running, but I think I’ll start with the embedded mode anyway to keep everything isolated and test SpoolmanSync on my Synology NAS.

Sounds good, let me know how it goes! If you run into any issues I will try to fix them as soon as possible.

I’ve got SpoolmanSync running now on my Synology NAS with Portainer, but ran into an issue along the way that might affect other Synology users, so I wanted to share what I found.

The Problem:
When using bind mounts (like /volume1/docker/spoolmansync/app-data:/data), the app container gets stuck in a restart loop with this error:
Schema engine error:
SQLite database error
unable to open database file: /data/spoolmansync.db

Interestingly, the Home Assistant container in the same stack works perfectly fine with the same setup.

What Works:
Switching to named volumes instead of bind mounts fixed it immediately:

volumes:
  - app-data:/data

Possible Cause:
Looking at the image layers in Portainer, I noticed the app container runs as user nextjs (UID 1001), while the Home Assistant container doesn’t specify a user (so it runs probably on root).

On Synology, bind-mounted directories often have different ownership, which might be why UID 1001 can’t write to them. Named volumes work because Docker handles the permissions automatically.

Suggestion:
If you have time, maybe the image could be adjusted to run as root (like the Home Assistant image does), or add support for custom PUID/PGID environment variables? That way it would work with both bind mounts and named volumes on all NAS systems.

1 Like

Thanks for testing this out on your Synology NAS, this is some great feedback and you’re spot on with the issue! The Home Assistant container was running as root while the SpoolmanSync app was running as the nextjs user (UID 1001).

For the sake of keeping this application as configuration-free as possible, I updated the code to run the SpoolmanSync container as root as well. This should give the app permissions to write to your bind mount regardless of the directory owner. New pre-built images have been pushed to both Github Container Registry and Docker Hub.

If you get a chance, it’d be great if you could test this out again on your NAS using a bind mount (I don’t have a NAS to test with). Things should work now, but let me know if there are any other issues!

What a great idea! I’m new to Bambu (A1 and AMS Lite) and 3D printing since Christmas, but a long time Home Assistant user.

I’ve got everything up and running, but when I try to assign a filament to Spoolmansync tray, I get a “Failed to Assign Spool” every time on every tray.

I’ve looked at your github documentation and the spoolmansync logs, but get no hints. Any thoughts?

Thanks for trying out SpoolmanSync! Let’s see if we can figure out what’s going on.

The spool assignment is handled between SpoolmanSync and Spoolman (Home Assistant isn’t involved in this step), so I have a few questions to help narrow down the issue:

  1. Can you confirm Spoolman is connected? When you click on a tray in the Dashboard, do you see your spools in the dropdown list?
  2. What’s the actual error? If you open your browser’s Developer Tools (F12), go to the Network tab, and then try assigning a spool again, you should see a failed request to /api/spools. Can you share what the Response body says?
  3. Docker logs: Can you share the output of docker logs spoolmansync-app? There should be more detailed error information there.
  4. Spoolman version: What version of Spoolman are you running? The version should be shown at the bottom of the Spoolman homepage.
  5. Spoolman URL: What URL did you configure for Spoolman in the Settings page? (Just want to make sure there’s no network/URL issue between the containers)

Also, just to confirm - the A1 with AMS Lite should work the same as the X1C with AMS (what I tested with) for this functionality, so that shouldn’t be the issue here.

Thanks for the reply. Here are my answers:

  1. Yes Spoolman shows as connected
  2. Here are the errors:

    963ecd286927afda.js:5
    Warning: Missing Description or aria-describedby={undefined} for {DialogContent}.
    963ecd286927afda.js:5

POST http://192.168.86.217:3000/api/spools 500 (Internal Server Error)


root@docker:~# docker logs spoolmansync-app
=== SpoolmanSync Starting ===
Running database migrations…
Loaded Prisma config from prisma.config.ts.

Prisma schema loaded from prisma/schema.prisma.
Datasource “db”: SQLite database “spoolmansync.db” at “file:/data/spoolmansync.db”

1 migration found in prisma/migrations

No pending migrations to apply.
Migrations complete.
Starting Next.js server…
▲ Next.js 16.1.1

✓ Starting…
✓ Ready in 91ms
SSE client disconnected
SSE client disconnected
SSE client disconnected
SSE client disconnected
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
SSE client disconnected
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
SSE client disconnected
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
SSE client disconnected
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88._.js:1:9617)
SSE client disconnected
SSE client disconnected
SSE client disconnected
SSE client disconnected
SSE client disconnected
SSE client disconnected
SSE client disconnected
SSE client disconnected
SSE client disconnected
SSE client disconnected
=== SpoolmanSync Starting ===
Running database migrations…
Loaded Prisma config from prisma.config.ts.

Prisma schema loaded from prisma/schema.prisma.
Datasource “db”: SQLite database “spoolmansync.db” at “file:/data/spoolmansync.db”

1 migration found in prisma/migrations

┌─────────────────────────────────────────────────────────┐
│ Update available 7.2.0 → 7.3.0 │
│ Run the following to update │
│ npm i --save-dev prisma@latest │
│ npm i @prisma/client@latest │
└─────────────────────────────────────────────────────────┘
No pending migrations to apply.
Migrations complete.
Starting Next.js server…
▲ Next.js 16.1.1

✓ Starting…
✓ Ready in 82ms
SSE client disconnected
SSE client disconnected
SSE client disconnected
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
SSE client disconnected
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
SSE client disconnected
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
SSE client disconnected
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
SSE client disconnected
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
SSE client disconnected
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
SSE client disconnected
SSE client disconnected
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
SSE client disconnected
SSE client disconnected
SSE client disconnected
Error getting Bambu Lab entries: TypeError: fetch failed
at async a.fetch (.next/server/chunks/[root-of-the-server]__6a826b16.
.js:1:5522)
at async b (.next/server/chunks/[root-of-the-server]__a94c3e47..js:1:11144)
at async c (.next/server/chunks/[root-of-the-server]__a94c3e47.
.js:1:15708)
at async l (.next/server/chunks/[root-of-the-server]__a94c3e47..js:1:16749)
at async Module.O (.next/server/chunks/[root-of-the-server]__a94c3e47.
.js:1:17827) {
[cause]: Error: connect ECONNREFUSED 192.168.86.101:8123
at (Error: connect ECONNREFUSED 192.168.86.101:8123) {
errno: -111,
code: ‘ECONNREFUSED’,
syscall: ‘connect’,
address: ‘192.168.86.101’,
port: 8123
}
}
Error fetching printers: TypeError: fetch failed
at async a.fetch (.next/server/chunks/[root-of-the-server]__6a826b16..js:1:5522)
at async a.discoverPrinters (.next/server/chunks/[root-of-the-server]__6a826b16.
.js:1:6149)
at async k (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:12975)
at async c (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:16566)
at async l (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:17607) {
[cause]: Error: connect ECONNREFUSED 192.168.86.101:8123
at (Error: connect ECONNREFUSED 192.168.86.101:8123) {
errno: -111,
code: ‘ECONNREFUSED’,
syscall: ‘connect’,
address: ‘192.168.86.101’,
port: 8123
}
}
SSE client disconnected
SSE client disconnected
SSE client disconnected
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
SSE client disconnected
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
SSE client disconnected
SSE client disconnected
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
SSE client disconnected
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
SSE client disconnected
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
SSE client disconnected
SSE client disconnected
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
SSE client disconnected
SSE client disconnected
Webhook received: {
event: ‘spool_usage’,
name: ‘Generic PLA’,
material: ‘PLA’,
tag_uid: ‘0000000000000000’,
used_weight: 1.03,
color: ‘#C52C18FF’,
active_tray_id: ‘sensor.a1_03919d530102410_ams_1_tray_1’
}
No spool assigned to tray sensor.a1_03919d530102410_ams_1_tray_1
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
SSE client disconnected
SSE client disconnected
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
SSE client disconnected
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
SSE client disconnected
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
Webhook received: {
event: ‘spool_usage’,
name: ‘Generic PLA’,
material: ‘PLA’,
tag_uid: ‘0000000000000000’,
used_weight: 6.68,
color: ‘#FFFFFFFF’,
active_tray_id: ‘sensor.a1_03919d530102410_ams_1_tray_3’
}
No spool assigned to tray sensor.a1_03919d530102410_ams_1_tray_3
SSE client disconnected
SSE client disconnected
SSE client disconnected
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
Webhook received: {
event: ‘spool_usage’,
name: ‘Generic PLA’,
material: ‘PLA’,
tag_uid: ‘0000000000000000’,
used_weight: 1.46,
color: ‘#C52C18FF’,
active_tray_id: ‘sensor.a1_03919d530102410_ams_1_tray_1’
}
No spool assigned to tray sensor.a1_03919d530102410_ams_1_tray_1
Webhook received: {
event: ‘spool_usage’,
name: ‘Generic PLA’,
material: ‘PLA’,
tag_uid: ‘0000000000000000’,
used_weight: 0.09,
color: ‘#C52C18FF’,
active_tray_id: ‘sensor.a1_03919d530102410_ams_1_tray_1’
}
No spool assigned to tray sensor.a1_03919d530102410_ams_1_tray_1
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
SSE client disconnected
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c.
.js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:9617)
Error assigning spool: Error: Spoolman API error: 400 - {“message”:“Unknown extra field active_tray.”}
at t.fetch (.next/server/chunks/[root-of-the-server]__c0c29a8c..js:1:1245)
at async S (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:3588)
at async p (.next/server/chunks/[root-of-the-server]__451a6c88..js:1:7498)
at async l (.next/server/chunks/[root-of-the-server]__451a6c88.
.js:1:8539)
at async Module.A (.next/server/chunks/[root-of-the-server]__451a6c88._.js:1:9617)

  1. Version 0.22.1 (1888240)
  2. http://192.168.86.217:7912

One last piece of info: I am running docker via Portainer. Not sure if that impacts at all?

Also when I connnected Home Assistant, I needed to edit the URL in the browser from 0.0.0.0:3000 to {myIP}:3000. After doing that it connected, so I assumed all well, It still shows connected, but I do see 0.0.0.0 a few times in the errors. Could that be part of the problem?

Thanks, those logs were helpful!

SpoolmanSync uses a Spoolman custom data field called active_tray to track spool-to-tray assignments. Your logs show that this field doesn’t exist in your Spoolman instance. You can confirm this by going to Settings → Extra Fields → Spools in Spoolman. Below is a screenshot from my instance showing the field configured:

I originally thought these were default Spoolman fields, but they’re not. I must have created them in the past for another app.

The fix: You can manually add an Extra Field called active_tray on the Spool object in Spoolman. However, I’ve just pushed a change to SpoolmanSync that automatically creates the active_tray and barcode fields via the Spoolman API when you connect (if they don’t already exist). You’ll see these logs when it does so:

[SpoolmanSync] Creating active_tray extra field in Spoolman (for tray assignments)...                                                                                    
[SpoolmanSync] active_tray extra field created successfully                                                                                                              
[SpoolmanSync] Creating barcode extra field in Spoolman (for barcode/QR code scanning)...                                                                                
[SpoolmanSync] barcode extra field created successfully

This should prevent the issue for others going forward.

Regarding the 0.0.0.0:3000 URL issue when connecting to an external Home Assistant instance – this was a separate bug. In Docker environments, the app was incorrectly using the server’s internal bind address instead of the actual host address you accessed it from. I’ve fixed this by using the HTTP Host header to determine the correct callback URL.

Let me know if this fixes the issues!

1 Like

Thank you so much! That extra field took care of it! GREAT WORK!!

1 Like

Hey! First, quick apology - I haven’t tested the new bind-mount images yet (waiting for my current print to finish), but wanted to report another finding while SpoolmanSync is working great otherwise! :blush:

Maybe I’m missing something here but I noticed the following:
SpoolmanSync receives the Bambu tag_uid from Home Assistant but doesn’t write it to Spoolman. This prevents automatic spool matching from working after first use (I typically don’t read out the tag_uid, when adding a spool to spoolman.

What SpoolmanSync receives from HA:

{
  "event": "spool_usage",
  "name": "Bambu PLA Basic",
  "material": "PLA",
  "tag_uid": "5D49443500000100",  ← Received
  "used_weight": 86.49,
  "color": "#8E9089FF",
  "active_tray_id": "sensor.x1c_00m09a391700764_ams_1_tray_1"
}

What SpoolmanSync writes to Spoolman:

{
  "spoolId": 4,
  "usedWeight": 86.49,
  "trayId": "sensor.x1c_00m09a391700764_ams_1_tray_1"
}

The tag_uid is received but not stored in Spoolman (e.g., in the tag field).

Without the tag_uid stored in Spoolman, automatic matching can not work. Please correct me, if I’m wrong here.

Suggested workflow:
If the tag_uid were stored on first manual assignment, the workflow would be perfect:

  1. First time: Manually assign spool in SpoolmanSync → at triggered update stores trayId AND tag_uid in Spoolman
  2. Next times: Move same spool to different tray → HA sends tag_uid → SpoolmanSync matches by UID → automatic assignment :white_check_mark:

So, if my above findings are correct could you add tag_uid storage to Spoolman? Something like:

{
  "spoolId": 4,
  "usedWeight": 86.49,
  "trayId": "sensor.x1c_00m09a391700764_ams_1_tray_1",
  "tag": "5D49443500000100" 
}

This would make automatic matching work reliably, even with many identical spools!

Thanks again for the great work on this project! :pray:

Thanks for the detailed analysis and suggestion! You’re absolutely right that we weren’t storing the tag_uid before. This was intentional to keep SpoolmanSync vendor-agnostic (many users have spools from Polymaker, Hatchbox, eSUN, etc. that don’t have RFID tags), but I completely understand this is a valuable feature for those using Bambu-branded spools.

I’ve pushed an update that now supports RFID tag auto-matching:

  • Tag storage on usage: When a print completes and SpoolmanSync deducts filament from a manually-assigned spool, it stores the tag_uid in Spoolman’s tag field. This happens on spool_usage events rather than assignment, since that’s when we have both a confirmed spool assignment AND a valid tag_uid from the printer. Multiple tags can be stored (comma-separated) to handle the tray position bug mentioned below.

  • Auto-assignment on tray changes: When you move a spool to a different tray, SpoolmanSync now attempts to match by tag_uid first. If a match is found, it auto-assigns the spool to the new tray.

  • Mismatch warning: Added a warning on the dashboard when the RFID data from the printer doesn’t match the manually assigned spool (helps catch cases where the wrong spool was assigned).

Two bugs I discovered while implementing this:

  1. Empty tray detection in ha-bambulab: There’s currently a bug where ha-bambulab doesn’t properly detect when a tray becomes empty (it only clears when payload is exactly {"id": "X"}, but the printer sometimes sends {"id": "X", "state": Y}). I submitted a PR to fix this: Fix empty tray detection for real-time updates by gibz104 · Pull Request #1857 · greghesp/ha-bambulab · GitHub - should be in the next release.

  2. tag_uid changes based on tray position: In my testing with an X1C and AMS on latest firmware, I’m seeing that the same physical spool reports different tag_uids depending on which tray it’s in. I’ve confirmed this is upstream of ha-bambulab - it’s visible in Bambu Handy and Bambu Studio as well. Filed an issue here: https://github.com/greghesp/ha-bambulab/issues/1856

Not sure if others are experiencing the second issue or if it’s specific to my setup, but because of it, I built SpoolmanSync to support storing multiple tag_uids per spool (comma-separated). So if Bambu reports different tags for the same spool in different trays, SpoolmanSync will accumulate them and match on any of the stored values.

Let me know how the update works for you once you get a chance to test!

Thanks for implementing this so quickly! I’ve done some initial testing and here are my findings:

What’s working:

  • Tag UID is successfully written to Spoolman after first print

Confirmed bugs:

  • Bug #1 confirmed: ha-bambulab doesn’t properly detect when a tray becomes empty - the entity still shows the old spool data
  • Bug #2 confirmed: The tag_uid changes when I move the spool to a different AMS slot or even to a different AMS unit

Auto-detection not working:

  • I moved a spool (that already has a stored tag_uid) to a different AMS slot
  • SpoolmanSync did not automatically detect/assign it to the new tray
  • No entries in the logs about the tray change (neither in spoolmansync or HA)
  • What’s the expected trigger for auto-detection? Do I need to do something specific, or should it happen automatically?

Ghost tray change during print:

  • During an active print, SpoolmanSync detected a tray change (reason unclear) and deducted weight. After the print finished, it deducted weight again. The total weight deduction was correct, so no functional impact. Just noting this as FYI.

BTW my setup is similar to yours: X1C with two AMS

Let me know if you need more details. Hpoefully I can test some more this evening.

1 Like

Thanks for trying it out!

The auto-detection should be automatic and not require you to do anything special. But if the spool has multiple tags, you will need to make sure both have been stored in Spoolman. I found that a single spool will report the same tag in tray 1 & 3 and a different tag in tray 2 & 4, so a single physical spool will have two tags (tag_uid) associated with it.

I had opened a support ticket about this with Bambu Lab because I thought a single spool should only have 1 tag_uid. Bambu Lab responded to me overnight and said that the tag_uid being broadcast over MQTT (and shown in ha-bambulab) is actually the unique id of the physical nfc/rfid tag, but since each spool has two of these, there will be two reported per spool. The correct unique id for a physical spool is Serial Number (SN), which I think may be stored as a data point on each nfc/rfid tag and broadcast in the MQTT stream. I’ll try and look into this more from the ha-bambulab side because I think using SN instead of tag_uid for auto-detection would be better.

I’ll do some additional testing this week on both the current auto-detection and the tag_uid/sn distinction (and also look into the ghost tray change you mentioned).

I’ve been testing and noticed two things that might be issues - but I’m not sure about the internal logic, so these are just observations:


Issue 1: Manual filament unload after aborted print not update spool usage

What I did:

  1. Started a print
  2. Had to abort the print (filament stayed loaded - AMS slot still blinking)
  3. Manually unloaded filament through printer menu

What I expected:
When manually unloading filament that was used during the aborted print, I thought SpoolmanSync might receive a weight update.

What happened:

  • HA detected the tray change (I think this is correct behavior)
  • The automation triggered, but only the helper was updated (last_tray)
  • No webhook seemed to be sent to SpoolmanSync
  • Filament usage wasn’t tracked

My understanding:

  • During the aborted print, it’s correct that nothing updates (filament is still loaded)
  • But when manually unloading, there’s accumulated print_weight from the aborted print
  • Maybe that weight should be reported at unload time?

My guess about a possible fix:
Maybe the automation could check: if a tray change occurs AND there’s accumulated print_weight > 0, send that weight to SpoolmanSync? But I might be misunderstanding how this is supposed to work. Or maybe there is a more clever way, with additional information from ha-bambulab


Issue 2: Auto-detection didn’t work in my test (possibly related to Bug #1?)

What I tested:

  • I have a spool with stored tag_uid from Tray 1
  • Moved the same spool to Tray 3 of the same AMS (based on your testing, Tray 1&3 should read the same Tag A)

What I expected:
Auto-detection would assign the spool to Tray 3 automatically.

What happened:

  • No auto-assignment occurred
  • I got a “possible mismatch” warning
  • (Note: Tray 3 previously had a different spool assigned in SpoolmanSync)

My theory:
Since ha-bambulab doesn’t report empty trays (Bug #1), maybe SpoolmanSync still thinks Tray 3 has the old spool? When the new tag_uid comes in and matches a different spool, it might see this as a conflict rather than an opportunity for auto-assignment?

Is the “empty tray” state a requirement for auto-detection to work?
Should I have manually cleared the old tray assignment in SpoolmanSync first?


I’m not familiar with the automation logic or exactly what data ha-bambulab provides, so I hope I’m not missing something obvious here.
Let me know if you need more details or if I should test something differently!

Possible Bug: Embedded Home Assistant only detects first AMS unit (AMS1), not second unit (AMS2)

I did some more testing and found out that there is a problem when I print from my second AMS unit.
As mentioned before I have a X1C with 2 AMS units connected.

Problem

I reconfigured the automations in Home Assistant and discovered in the logs that it only creates entities for AMS1 (4 trays) and the external spool. AMS2 trays are completely missing. But in the SpoolmanSync App the AMS2 trays are visible.

Test Results

So I printed the exact same model from 3 different trays to isolate the issue:

Print Tray Used Usage Tracking SpoolmanSync Update
1 AMS1 Tray 4 (Marine Blue) Track 0.45g usage :white_check_mark: Tracked correctly :white_check_mark: Deducted 0.45g from spool #38
2 AMS2 Tray 1 (Charcoal) Track 0.47g usage :x: Reports to wrong tray :x: Deducted 0.47g from spool Marine Blue #38
3 AMS1 Tray 2 (Dark Brown) Track 0.45g usage :white_check_mark: Tracked correctly :white_check_mark: Deducted 0.45g from spool #7

HA Entities Created on Startup

✅ sensor.x1c_xxxxxxxxxxxxxxxxx_externalspool_external_spool
✅ sensor.x1c_xxxxxxxxxxxxxxxxx_ams_1_tray_1
✅ sensor.x1c_xxxxxxxxxxxxxxxxx_ams_1_tray_2
✅ sensor.x1c_xxxxxxxxxxxxxxxxx_ams_1_tray_3
✅ sensor.x1c_xxxxxxxxxxxxxxxxx_ams_1_tray_4

❌ sensor.x1c_xxxxxxxxxxxxxxxxx_ams_2_tray_1 (NOT created)
❌ sensor.x1c_xxxxxxxxxxxxxxxxx_ams_2_tray_2 (NOT created)
❌ sensor.x1c_xxxxxxxxxxxxxxxxx_ams_2_tray_3 (NOT created)
❌ sensor.x1c_xxxxxxxxxxxxxxxxx_ams_2_tray_4 (NOT created)

Logs - AMS1 Print (Working :white_check_mark:)

Print from AMS1 Tray 4:

22:02:14 SPOOLMANSYNC PRINT END | Tray 4 | Spool: Bambu PLA Matte (PLA) | Weight used: 0.45g | Tag UID: 6DC25EF400000100

SpoolmanSync Activity:

{
  "spoolId": 38,
  "usedWeight": 0.45,
  "trayId": "sensor.x1c_xxxxxxxxxxxxxxxxx_ams_1_tray_4",
  "tagStored": true
}

:white_check_mark: Result: Filament usage tracked correctly

Logs - AMS2 Print (Broken :x:)

Print from AMS2 Tray 1 (same model as above):

22:14:53 SPOOLMANSYNC PRINT END | Tray 4 | Spool: Bambu PLA Matte (PLA) | Weight used: 0.47g | Tag UID: 6DC25EF400000100

SpoolmanSync Activity:

{
  "spoolId": 38,
  "usedWeight": 0.47,
  "trayId": "sensor.x1c_xxxxxxxxxxxxxxxxx_ams_1_tray_4",
  "tagStored": true
}

:x: Result: Filament usage tracked from the wrong spool. Should be Matte Charcoal (spoolID: 3)

Logs - AMS1 Print (Working :white_check_mark:)

Print from AMS1 Tray 2:

22:30:50 SPOOLMANSYNC PRINT END | Tray 2 | Spool: Bambu PLA Matte (PLA) | Weight used: 0.45g | Tag UID: CC59E65400000100

SpoolmanSync Activity:

{
  "spoolId": 7,
  "usedWeight": 0.45,
  "trayId": "sensor.x1c_xxxxxxxxxxxxxxxxx_ams_1_tray_2",
  "tagStored": true
}

:white_check_mark: Result: Filament usage tracked correctly

So HA uses the exact same spool as in the print before because it does not know the right tray in AMS2.

I hope I could explain the issue I ran into.
If you have any further questions, please let me know.

BTW: This is maybe also the reason for the behaviour I described in my post yesterday

1 Like