Spoolman Updater – Automate Filament Tracking

That is not working as intended. Spoolman and the updater doesn’t look for the brand and/or color of the filament but it connects to the active tray within Spoolman.
So, the whole process is based on the active tray sensor.
Steps before printing:
Set the correct spool in Spoolman Updater and start printing, that should be it.

Please check the following: select the spool in Spoolman Updater and then go to Spoolman. View the spool you have selected in the updater and scroll all the way below to the extra fields. Is the active tray field filled in with the correct sensor name?

Thank you for confirming. I think I got it working. I think I ran into an edge case (or I’m an idiot…perhaps both) that I over-corrected for, then missed a few edits while dialing back my correction.

Getting some affirmation that it should be working as I thought it should made me go back through with a fine toothed comb.

I’m going to run a test to see if my edge case theory is correct and see if I can solve it with a firmware update. If it feels relevant, I’ll share an update here.

After a long break, I’ve now implemented everything for my P2S, after the A1 stopped working following an update. In parallel, I’m currently building a new UI and reworking the YAML for Home Assistant:

could you please share how to do it?? thanks!

Hi all,

Yesterday, the Spoolman addons and the bambulab integration have been updated. Does anybody tested already these updates. as they announced breaking changes, I am afraid to loose again the all spoolman updater which works perfectly until now. Thanks for your replies.

Hi,
i updated to the latest Versions of spoolman and bambulab.
For me its working! For my understanding, all the old configs should work.

But i can understand you, i wasnt sure at first… I hope it will work for you!

Hi everyone,

I’m currently running Spoolman-Updater on my Unraid server, Spoolman in Docker, and Home Assistant in a VM.
My printer is a Bambu Lab P2S with 2× AMS, and I’ve been trying to get the integration stable.

The issue(s):

1. The Docker container crashes every night

The Spoolman-Updater container runs perfectly all day long, but around midnight it suddenly crashes and becomes completely corrupted.

After the crash:

  • the container won’t start anymore
  • logs are empty
  • I have to delete the container entirely and recreate it from the image
  • after recreating, everything works again… until the next midnight

It looks like some kind of memory corruption or an unhandled exception.
This does not happen when Spoolman or HA restart — only by itself around 00:00.

Has anyone else seen this behavior?


2. Tray changes are not being sent to Spoolman

I have both automations working:

  • Version without tray helper:
    → Tray changes sometimes try to write tray 0, which breaks the update.
  • Version with the tray helper value:
    Print end updates work perfectly.
    → But tray-change triggers are not updating Spoolman (nothing is written).

So I either:

  • get wrong tray numbers (tray 0 issue),
    or
  • lose all updates during multi-color printing,
    depending on which version I use.

Does anyone have a working automation specifically for:

Bambu Lab P2S + (one or two) AMS units

with multi-color printing and correct tray tracking?

I’ve already checked entity names, checked state attributes, and verified the sensors.
The usage meter resets correctly and the automation logs look fine — except the tray-change not pushing any weights.


My setup

  • Unraid 7.20+
  • Spoolman Docker
  • Spoolman-Updater Docker (marcokreeft/spoolman-updater:latest)
  • Home Assistant VM (KVM)
  • Bambu Lab P2S
  • AMS 1 + AMS 2
  • 8 trays + external spool sensor

Everything works except:

  • nightly Docker crash
  • tray-change not writing to Spoolman

What I’m looking for

  • Anyone with P2S + multiple AMS who has the Updater working reliably
  • A working automation YAML for multi-color printing
  • Any hints why the Docker container corrupts itself around midnight
  • If the Updater supports 2× AMS correctly or if I need custom env vars

Thanks in advance — any help or working config would be amazing!

For the docker crash, I am not able to help as I am not using it on Unraid.

Are you running both automations at the same time?
Nevertheless, can you please share your full yaml configuration please? The ones I wrote are based on the P1S and the H2S, so I am not sure how the P2S behaves. It all depends how the printer behaves when print ends.
Also, within the automation I have placed a syslog, also please share those. Those are within the Automation - traces. There you are able to see exactly what is happening and why.

Writing to the tray 0 is actually impossible as in the version without the tray helper, you define the tray numbers. The same goes for the one with the tray helper.
Also, if you have more then one AMS unit, you need to alter this within your yaml files and your spoolman updater env in Docker.

If you could provide met with the information, I might be able to figure it out for you.

Here is my current automation.
The tray sensor and the last-tray helper both work correctly

alias: Bambulab - Update Spool (with last_tray helper + debug )
description: Update spool
triggers:
  - entity_id: sensor.bambulab_ams1_tray_index
    id: tray
    trigger: state
  - entity_id: sensor.p2s_22e8bj582800104_aktueller_arbeitsschritt
    to:
      - finished
      - idle
    id: print_end
    trigger: state
actions:
  - choose:
      - conditions:
          - condition: trigger
            id: tray
        sequence:
          - target:
              entity_id: input_number.bambulab_last_tray
            data:
              value: "{{ trigger.to_state.state | int }}"
            action: input_number.set_value
          - data:
              message: >-
                Tray change: input_number.bambulab_last_tray -> {{
                trigger.to_state.state }}
              level: info
            action: system_log.write
      - conditions:
          - condition: trigger
            id: print_end
        sequence:
          - variables:
              tray_number: "{{ states('input_number.bambulab_last_tray') | int }}"
              tray_sensor: sensor.p2s_22e8bj582800104_ams_1_slot_{{ tray_number }}
              tray_weight: >-
                {{ states('sensor.bambulab_filament_usage_meter') | float(0) |
                round(2) }}
              tag_uid: "{{ state_attr(tray_sensor, 'tag_uid') }}"
              material: "{{ state_attr(tray_sensor, 'type') }}"
              name: "{{ state_attr(tray_sensor, 'name') }}"
              color: "{{ state_attr(tray_sensor, 'color') }}"
          - data:
              message: >-
                Print end trigger. Last Tray: {{ tray_number }} ({{ name }} - {{
                material }}) Weight: {{ tray_weight }}g Color: {{ color }} Tag
                UID: {{ tag_uid }}
              level: info
            action: system_log.write
          - data:
              filament_name: "{{ name }}"
              filament_material: "{{ material }}"
              filament_tag_uid: "{{ tag_uid }}"
              filament_used_weight: "{{ tray_weight }}"
              filament_color: "{{ color }}"
              filament_active_tray_id: "{{ tray_sensor | replace('sensor.', '') }}"
            action: rest_command.update_spool
          - target:
              entity_id: sensor.bambulab_filament_usage_meter
            data:
              value: "0"
            action: utility_meter.calibrate
mode: single

Thanks. But can you please post everything I have asked for? Also, which version of the Bambu integration in HA are you using?

Here is the information you requested. And The Automation run not to the same time
I am running the Bambu Integration Version 2.2.16.

Template sensors (from /config/sensors/)

platform: template
sensors:
  bambulab_filament_usage:
    unique_id: b954300e-d3a2-44ab-948f-39c30b2f0c00
    friendly_name: "Bambu Lab Filament Usage"
    value_template: >
      {{ states('sensor.p2s_22e8bj582800104_gewicht_des_drucks') | float(0) / 100 *
         states('sensor.p2s_22e8bj582800104_druckfortschritt') | float(0) }}
    availability_template: >-
      {% if is_state('sensor.p2s_22e8bj582800104_gewicht_des_drucks', 'unknown')
         or is_state('sensor.p2s_22e8bj582800104_gewicht_des_drucks', 'unavailable') %}
        false
      {% else %}
        true
      {% endif %}

  bambulab_ams1_tray_index:
    friendly_name: "Bambu Lab AMS1 Tray Index"
    value_template: >-
      {% set trays = [1,2,3,4] %}
      {% for tray in trays %}
        {% set eid = 'sensor.p2s_22e8bj582800104_ams_1_slot_' ~ tray %}
        {% if state_attr(eid, 'active') in [true, 'true', 'True'] %}
          {{ tray }}
          {% break %}
        {% endif %}
      {% endfor %}
    availability_template: >-
      {{ expand([
        'sensor.p2s_22e8bj582800104_ams_1_slot_1',
        'sensor.p2s_22e8bj582800104_ams_1_slot_2',
        'sensor.p2s_22e8bj582800104_ams_1_slot_3',
        'sensor.p2s_22e8bj582800104_ams_1_slot_4'
      ]) | selectattr('attributes.active','defined') | list | count > 0 }}

REST command

rest_command:
  update_spool:
    url: "http://192.168.178.23:8080/Spools"
    method: POST
    headers:
      Content-Type: "application/json"
    payload: >
      {
        "name": "{{ filament_name }}",
        "material": "{{ filament_material }}",
        "tag_uid": "{{ filament_tag_uid }}",
        "used_weight": {{ filament_used_weight | int }},
        "color": "{{ filament_color }}",
        "active_tray_id": "{{ filament_active_tray_id }}"
      }

Helper

input_number:
  bambulab_last_tray:
    name: "BambuLab Last Tray"
    min: 0
    max: 5
    step: 1

Before I dive in, I just posted it also in here: there are breaking changed in the new version V2.2.16, which I suspect is causing issues, as they changed some states. As it is just release, I haven’t had the time to fully check.
Can you please go back one version and try again?

If that doesn’t help, please also post your log files from the automation itself.

ps. if you are using 2 AMS systems and are printing from, for example, tray 7, it will also not work. You need to change your last tray input helper, tray index within the sensor and make sure your ENV are setup correctly in Docker

pps, as mentioned before in this thread, I am unsure how the P2S works, it could as the P1S or the H2S. So, not sure which of the two automations will work.

Here is a Trace from filament change. I Rollback and test

{
  "trace": {
    "last_step": "action/0/choose/0/sequence/1",
    "run_id": "79866348ac0315431c96110a57e0dfac",
    "state": "stopped",
    "script_execution": "finished",
    "timestamp": {
      "start": "2025-11-29T18:22:42.887703+00:00",
      "finish": "2025-11-29T18:22:42.888370+00:00"
    },
    "domain": "automation",
    "item_id": "1764422987345",
    "trigger": "state of sensor.bambulab_ams1_tray_index",
    "trace": {
      "trigger/0": [
        {
          "path": "trigger/0",
          "timestamp": "2025-11-29T18:22:42.887728+00:00",
          "changed_variables": {
            "this": {
              "entity_id": "automation.bambulab_update_spool_with_last_tray_helper_debug",
              "state": "on",
              "attributes": {
                "id": "1764422987345",
                "last_triggered": "2025-11-29T18:22:41.861836+00:00",
                "mode": "single",
                "current": 0,
                "friendly_name": "Bambulab - Update Spool (with last_tray helper + debug )"
              },
              "last_changed": "2025-11-29T18:10:28.516324+00:00",
              "last_reported": "2025-11-29T18:22:41.862502+00:00",
              "last_updated": "2025-11-29T18:22:41.862502+00:00",
              "context": {
                "id": "01KB8DMP653NFFB5JYWQ4SY8KC",
                "parent_id": "01KB8DMP655PAQ3KH8BA1A1DAG",
                "user_id": null
              }
            },
            "trigger": {
              "id": "tray",
              "idx": "0",
              "alias": null,
              "platform": "state",
              "entity_id": "sensor.bambulab_ams1_tray_index",
              "from_state": {
                "entity_id": "sensor.bambulab_ams1_tray_index",
                "state": "",
                "attributes": {
                  "friendly_name": "Bambu Lab AMS1 Tray Index"
                },
                "last_changed": "2025-11-29T18:22:41.861678+00:00",
                "last_reported": "2025-11-29T18:22:41.861678+00:00",
                "last_updated": "2025-11-29T18:22:41.861678+00:00",
                "context": {
                  "id": "01KB8DMP655PAQ3KH8BA1A1DAG",
                  "parent_id": null,
                  "user_id": null
                }
              },
              "to_state": {
                "entity_id": "sensor.bambulab_ams1_tray_index",
                "state": "2",
                "attributes": {
                  "friendly_name": "Bambu Lab AMS1 Tray Index"
                },
                "last_changed": "2025-11-29T18:22:42.887610+00:00",
                "last_reported": "2025-11-29T18:22:42.887610+00:00",
                "last_updated": "2025-11-29T18:22:42.887610+00:00",
                "context": {
                  "id": "01KB8DMQ66PM3RVVJWEZ6PR13D",
                  "parent_id": null,
                  "user_id": null
                }
              },
              "for": null,
              "attribute": null,
              "description": "state of sensor.bambulab_ams1_tray_index"
            }
          }
        }
      ],
      "action/0": [
        {
          "path": "action/0",
          "timestamp": "2025-11-29T18:22:42.887828+00:00",
          "changed_variables": {
            "context": {
              "id": "01KB8DMQ67R52TRXWJQMZKX1P6",
              "parent_id": "01KB8DMQ66PM3RVVJWEZ6PR13D",
              "user_id": null
            }
          },
          "result": {
            "choice": 0
          }
        }
      ],
      "action/0/choose/0": [
        {
          "path": "action/0/choose/0",
          "timestamp": "2025-11-29T18:22:42.887857+00:00",
          "result": {
            "result": true
          }
        }
      ],
      "action/0/choose/0/conditions/0": [
        {
          "path": "action/0/choose/0/conditions/0",
          "timestamp": "2025-11-29T18:22:42.887872+00:00",
          "result": {
            "result": true
          }
        }
      ],
      "action/0/choose/0/sequence/0": [
        {
          "path": "action/0/choose/0/sequence/0",
          "timestamp": "2025-11-29T18:22:42.887936+00:00",
          "result": {
            "params": {
              "domain": "input_number",
              "service": "set_value",
              "service_data": {
                "value": 2,
                "entity_id": [
                  "input_number.bambulab_last_tray"
                ]
              },
              "target": {
                "entity_id": [
                  "input_number.bambulab_last_tray"
                ]
              }
            },
            "running_script": false
          }
        }
      ],
      "action/0/choose/0/sequence/1": [
        {
          "path": "action/0/choose/0/sequence/1",
          "timestamp": "2025-11-29T18:22:42.888187+00:00",
          "result": {
            "params": {
              "domain": "system_log",
              "service": "write",
              "service_data": {
                "message": "Tray change: input_number.bambulab_last_tray -> 2",
                "level": "info"
              },
              "target": {}
            },
            "running_script": false
          }
        }
      ]
    },
    "config": {
      "id": "1764422987345",
      "alias": "Bambulab - Update Spool (with last_tray helper + debug )",
      "description": "Update spool",
      "triggers": [
        {
          "entity_id": "sensor.bambulab_ams1_tray_index",
          "id": "tray",
          "trigger": "state"
        },
        {
          "entity_id": "sensor.p2s_22e8bj582800104_aktueller_arbeitsschritt",
          "to": [
            "finished",
            "idle"
          ],
          "id": "print_end",
          "trigger": "state"
        }
      ],
      "actions": [
        {
          "choose": [
            {
              "conditions": [
                {
                  "condition": "trigger",
                  "id": "tray"
                }
              ],
              "sequence": [
                {
                  "target": {
                    "entity_id": "input_number.bambulab_last_tray"
                  },
                  "data": {
                    "value": "{{ trigger.to_state.state | int }}"
                  },
                  "action": "input_number.set_value"
                },
                {
                  "data": {
                    "message": "Tray change: input_number.bambulab_last_tray -> {{ trigger.to_state.state }}",
                    "level": "info"
                  },
                  "action": "system_log.write"
                }
              ]
            },
            {
              "conditions": [
                {
                  "condition": "trigger",
                  "id": "print_end"
                }
              ],
              "sequence": [
                {
                  "variables": {
                    "tray_number": "{{ states('input_number.bambulab_last_tray') | int }}",
                    "tray_sensor": "sensor.p2s_22e8bj582800104_ams_1_slot_{{ tray_number }}",
                    "tray_weight": "{{ states('sensor.bambulab_filament_usage_meter') | float(0) | round(2) }}",
                    "tag_uid": "{{ state_attr(tray_sensor, 'tag_uid') }}",
                    "material": "{{ state_attr(tray_sensor, 'type') }}",
                    "name": "{{ state_attr(tray_sensor, 'name') }}",
                    "color": "{{ state_attr(tray_sensor, 'color') }}"
                  }
                },
                {
                  "data": {
                    "message": "Print end trigger. Last Tray: {{ tray_number }} ({{ name }} - {{ material }}) Weight: {{ tray_weight }}g Color: {{ color }} Tag UID: {{ tag_uid }}",
                    "level": "info"
                  },
                  "action": "system_log.write"
                },
                {
                  "data": {
                    "filament_name": "{{ name }}",
                    "filament_material": "{{ material }}",
                    "filament_tag_uid": "{{ tag_uid }}",
                    "filament_used_weight": "{{ tray_weight }}",
                    "filament_color": "{{ color }}",
                    "filament_active_tray_id": "{{ tray_sensor | replace('sensor.', '') }}"
                  },
                  "action": "rest_command.update_spool"
                },
                {
                  "target": {
                    "entity_id": "sensor.bambulab_filament_usage_meter"
                  },
                  "data": {
                    "value": "0"
                  },
                  "action": "utility_meter.calibrate"
                }
              ]
            }
          ]
        }
      ],
      "mode": "single"
    },
    "blueprint_inputs": null,
    "context": {
      "id": "01KB8DMQ67R52TRXWJQMZKX1P6",
      "parent_id": "01KB8DMQ66PM3RVVJWEZ6PR13D",
      "user_id": null
    }
  },
  "logbookEntries": [
    {
      "name": "Bambulab - Update Spool (with last_tray helper + debug )",
      "message": "triggered by state of sensor.bambulab_ams1_tray_index",
      "source": "state of sensor.bambulab_ams1_tray_index",
      "entity_id": "automation.bambulab_update_spool_with_last_tray_helper_debug",
      "context_id": "01KB8DMQ67R52TRXWJQMZKX1P6",
      "domain": "automation",
      "when": 1764440562.8877528
    },
    {
      "state": "2.0",
      "entity_id": "input_number.bambulab_last_tray",
      "when": 1764440562.8881106,
      "context_event_type": "automation_triggered",
      "context_domain": "automation",
      "context_name": "Bambulab - Update Spool (with last_tray helper + debug )",
      "context_message": "triggered by state of sensor.bambulab_ams1_tray_index",
      "context_source": "state of sensor.bambulab_ams1_tray_index",
      "context_entity_id": "automation.bambulab_update_spool_with_last_tray_helper_debug"
    }
  ]
}

So, this trace shows that it has registered the tray change correctly, tray 2 was used. But to see this further, I need to see the full log of print end. But let’s wait for the rollback outcome.
I did some fast checking and by the looks of it, it should not break anything with the new update. But this all depends on which states the printers are using.

Thanks for the quick reply!

I can share the full automation trace for the print-end trigger later this evening when the current print finishes.

Regarding the tray change part:
The automation does detect every tray switch correctly .
However, no data is being sent to the Spoolman updater during tray changes — only the log message is executed.

So the tray-change trigger fires, the variables resolve, the log is written, but the rest_command.update_spool is never executed in that branch.

I will send the trace for the print-end event later today.
If you also want the trace for a tray-change event, I can provide that as well.

Let me know what else you need.

I did another test:
I manually set the printer state to idle, and in that case the print-end branch works correctly — the value is sent to Spoolman and the updater receives it.

So the print-end part of the automation is fine.

Attached is the trace from that manual idle trigger.

The only remaining issue is that tray-change events never send anything to Spoolman.
The tray-change trigger fires, the helper updates, and the log entry appears — but the rest_command.update_spool action does not run during a tray change.

Let me know if you want me to capture a full tray-change trace as well.

{
  "trace": {
    "last_step": "action/0/choose/1/sequence/3",
    "run_id": "588b03cd9ebbcc424494b42b0a193b65",
    "state": "stopped",
    "script_execution": "finished",
    "timestamp": {
      "start": "2025-12-02T13:12:45.617293+00:00",
      "finish": "2025-12-02T13:12:45.666962+00:00"
    },
    "domain": "automation",
    "item_id": "1764422987345",
    "trigger": "state of sensor.p2s_22e8bj582800104_aktueller_arbeitsschritt",
    "trace": {
      "trigger/1": [
        {
          "path": "trigger/1",
          "timestamp": "2025-12-02T13:12:45.617340+00:00",
          "changed_variables": {
            "this": {
              "entity_id": "automation.bambulab_update_spool_with_last_tray_helper_debug",
              "state": "on",
              "attributes": {
                "id": "1764422987345",
                "last_triggered": "2025-12-02T10:28:45.110221+00:00",
                "mode": "single",
                "current": 0,
                "friendly_name": "Bambulab - Update Spool (with last_tray helper + debug )"
              },
              "last_changed": "2025-12-02T10:16:23.834627+00:00",
              "last_reported": "2025-12-02T10:28:45.111395+00:00",
              "last_updated": "2025-12-02T10:28:45.111395+00:00",
              "context": {
                "id": "01KBF9Q0XPJ2T5KCZD2QVET5JJ",
                "parent_id": "01KBF9Q0XNY8GEE3KEJRWSY6BR",
                "user_id": null
              }
            },
            "trigger": {
              "id": "print_end",
              "idx": "1",
              "alias": null,
              "platform": "state",
              "entity_id": "sensor.p2s_22e8bj582800104_aktueller_arbeitsschritt",
              "from_state": {
                "entity_id": "sensor.p2s_22e8bj582800104_aktueller_arbeitsschritt",
                "state": "printing",
                "attributes": {
                  "options": [
                    "paused_first_layer_error",
                    "paused_ams_lost",
                    "idle",
                    "check_birdeye_camera_position",
                    "paused_skipped_step",
                    "paused_front_cover_falling",
                    "paused_user",
                    "calibrating_motor_noise",
                    "bed_level_phase_2",
                    "paused_chamber_temperature_control_error",
                    "check_plaform",
                    "check_absolute_accuracy_after_calibration",
                    "heating_hotend",
                    "check_door_and_cover",
                    "heating_chamber",
                    "filament_loading",
                    "cleaning_nozzle_tip",
                    "paused_nozzle_clog",
                    "bed_level_phase_1",
                    "check_absolute_accuracy_before_calibration",
                    "bed_level_high_temperature",
                    "cooling_chamber",
                    "unknown",
                    "checking_extruder_temperature",
                    "paused_filament_runout",
                    "scanning_bed_surface",
                    "filament_unloading",
                    "calibrating_extrusion_flow",
                    "laser_calibration",
                    "absolute_accuracy_calibration",
                    "calibrate_birdeye_camera",
                    "calibrating_micro_lidar",
                    "printing",
                    "paused_low_fan_speed_heat_break",
                    "paused_user_gcode",
                    "check_quick_release",
                    "paused_nozzle_filament_covered_detected",
                    "homing_toolhead",
                    "paused_nozzle_temperature_malfunction",
                    "paused_cutter_error",
                    "m400_pause",
                    "inspecting_first_layer",
                    "calibrate_nozzle_offset",
                    "calibrating_extrusion",
                    "paused_heat_bed_temperature_malfunction",
                    "heatbed_preheating",
                    "auto_bed_leveling",
                    "changing_filament",
                    "motor_noise_showoff",
                    "identifying_build_plate_type",
                    "heated_bedcooling",
                    "print_calibration_lines",
                    "sweeping_xy_mech_mode",
                    "offline"
                  ],
                  "device_class": "enum",
                  "friendly_name": "P2S_22E8BJ582800104 Aktueller Arbeitsschritt"
                },
                "last_changed": "2025-12-02T10:16:27.145456+00:00",
                "last_reported": "2025-12-02T10:16:36.223880+00:00",
                "last_updated": "2025-12-02T10:16:27.145456+00:00",
                "context": {
                  "id": "01KBF90G8992D2FTCK1DKRG9F3",
                  "parent_id": null,
                  "user_id": null
                }
              },
              "to_state": {
                "entity_id": "sensor.p2s_22e8bj582800104_aktueller_arbeitsschritt",
                "state": "idle",
                "attributes": {
                  "options": [
                    "paused_first_layer_error",
                    "paused_ams_lost",
                    "idle",
                    "check_birdeye_camera_position",
                    "paused_skipped_step",
                    "paused_front_cover_falling",
                    "paused_user",
                    "calibrating_motor_noise",
                    "bed_level_phase_2",
                    "paused_chamber_temperature_control_error",
                    "check_plaform",
                    "check_absolute_accuracy_after_calibration",
                    "heating_hotend",
                    "check_door_and_cover",
                    "heating_chamber",
                    "filament_loading",
                    "cleaning_nozzle_tip",
                    "paused_nozzle_clog",
                    "bed_level_phase_1",
                    "check_absolute_accuracy_before_calibration",
                    "bed_level_high_temperature",
                    "cooling_chamber",
                    "unknown",
                    "checking_extruder_temperature",
                    "paused_filament_runout",
                    "scanning_bed_surface",
                    "filament_unloading",
                    "calibrating_extrusion_flow",
                    "laser_calibration",
                    "absolute_accuracy_calibration",
                    "calibrate_birdeye_camera",
                    "calibrating_micro_lidar",
                    "printing",
                    "paused_low_fan_speed_heat_break",
                    "paused_user_gcode",
                    "check_quick_release",
                    "paused_nozzle_filament_covered_detected",
                    "homing_toolhead",
                    "paused_nozzle_temperature_malfunction",
                    "paused_cutter_error",
                    "m400_pause",
                    "inspecting_first_layer",
                    "calibrate_nozzle_offset",
                    "calibrating_extrusion",
                    "paused_heat_bed_temperature_malfunction",
                    "heatbed_preheating",
                    "auto_bed_leveling",
                    "changing_filament",
                    "motor_noise_showoff",
                    "identifying_build_plate_type",
                    "heated_bedcooling",
                    "print_calibration_lines",
                    "sweeping_xy_mech_mode",
                    "offline"
                  ],
                  "device_class": "enum",
                  "friendly_name": "P2S_22E8BJ582800104 Aktueller Arbeitsschritt"
                },
                "last_changed": "2025-12-02T13:12:45.616913+00:00",
                "last_reported": "2025-12-02T13:12:45.616913+00:00",
                "last_updated": "2025-12-02T13:12:45.616913+00:00",
                "context": {
                  "id": "01KBFK3ASGXJ4WK6TGFPA5M8NJ",
                  "parent_id": null,
                  "user_id": "9da944317a6a41a9b3f4e58707b1998a"
                }
              },
              "for": null,
              "attribute": null,
              "description": "state of sensor.p2s_22e8bj582800104_aktueller_arbeitsschritt"
            }
          }
        }
      ],
      "action/0": [
        {
          "path": "action/0",
          "timestamp": "2025-12-02T13:12:45.617505+00:00",
          "changed_variables": {
            "context": {
              "id": "01KBFK3ASHZ6KEH6GBTK4H3DJQ",
              "parent_id": "01KBFK3ASGXJ4WK6TGFPA5M8NJ",
              "user_id": null
            },
            "tray_number": 1,
            "tray_sensor": "sensor.p2s_22e8bj582800104_ams_1_slot_1",
            "tray_weight": 198.43,
            "tag_uid": "1AAD1A7600000100",
            "material": "ABS",
            "name": "Bambu ABS",
            "color": "```

Currently running some tests and will post an update soon :wink:

Tested this one with my H2S and is working perfectly, with the new Bambu Update:

alias: Bambulab - Update Spool
description: Update spool with tray change
triggers:
  - entity_id: sensor.bambulab_ams1_tray_index
    id: tray
    trigger: state
  - entity_id: sensor.ID_PRINTER_current_stage
    to:
      - finished
      - idle
    id: print_end
    trigger: state
actions:
  - choose:
      - conditions:
          - condition: template
            value_template: >-
              {{ trigger.id == 'tray' and old_tray is not none and old_tray > 0 }}
        sequence:
          - data:
              message: >-
                Tray wissel: oude tray {{ old_tray }} → {{ name }} ({{ material }}),
                Gewicht: {{ tray_weight }} g, Kleur: {{ color }}, Tag UID: {{ tag_uid }}
              level: info
            action: system_log.write

          - data:
              filament_name: "{{ name }}"
              filament_material: "{{ material }}"
              filament_tag_uid: "{{ tag_uid }}"
              filament_used_weight: "{{ tray_weight }}"
              filament_color: "{{ color }}"
              filament_active_tray_id: "{{ tray_sensor | replace('sensor.', '') }}"
            action: rest_command.update_spool
          - target:
              entity_id: sensor.bambulab_filament_usage_meter
            data:
              value: "0"
            action: utility_meter.calibrate
          - target:
              entity_id: input_number.bambulab_last_tray
            data:
              value: "{{ trigger.to_state.state | int(default=old_tray) }}"
            action: input_number.set_value
          - data:
              message: >-
                input_number.bambulab_last_tray → {{ trigger.to_state.state |
                int(default=old_tray) }}
              level: info
            action: system_log.write

      - conditions:
          - condition: template
            value_template: >-
              {{ trigger.id == 'print_end' and tray_number is not none and tray_number > 0 }}
        sequence:
          - data:
              message: >-
                Print-einde: Tray {{ tray_number }} → {{ name }} ({{ material }}),
                Gewicht: {{ tray_weight }} g
              level: info
            action: system_log.write

          - data:
              filament_name: "{{ name }}"
              filament_material: "{{ material }}"
              filament_tag_uid: "{{ tag_uid }}"
              filament_used_weight: "{{ tray_weight }}"
              filament_color: "{{ color }}"
              filament_active_tray_id: "{{ tray_sensor | replace('sensor.', '') }}"
            action: rest_command.update_spool
          - target:
              entity_id: sensor.bambulab_filament_usage_meter
            data:
              value: "0"
            action: utility_meter.calibrate

variables:
  old_tray: |-
    {% if trigger.id == 'tray'
          and trigger.from_state.state not in [None, '', 'unknown', 'unavailable'] %}
      {{ trigger.from_state.state | int }}
    {% else %}
      None
    {% endif %}
  tray_number: |-
    {% if trigger.id == 'print_end' %}
      {{ states('input_number.bambulab_last_tray') | int }}
    {% else %}
      {{ old_tray }}
    {% endif %}
  tray_sensor: |-
    {% if tray_number %}
      sensor.ID_PRINTER_ams_1_tray_{{ tray_number }}
    {% else %}
      None
    {% endif %}
  tray_weight: "{{ states('sensor.bambulab_filament_usage_meter') | float(0) | round(2) }}"
  tag_uid: "{{ state_attr(tray_sensor, 'tag_uid') if tray_sensor else None }}"
  material: "{{ state_attr(tray_sensor, 'type') if tray_sensor else None }}"
  name: "{{ state_attr(tray_sensor, 'name') if tray_sensor else None }}"
  color: "{{ state_attr(tray_sensor, 'color') if tray_sensor else None }}"
mode: single

Only change the automation, everything else can be left unchanged.

Hi everyone,
since the recent automation update everything has been running smoothly so far. I haven’t tested a multicolor print yet, but I’m planning to do that this weekend.

One question: for the second AMS, do I need to rename the entities so the slots become 5, 6, etc. in order for the automation to work correctly?

Also, I think I figured out the issue with Docker/Spoolman being unreachable for a moment — it was caused by my Home Assistant backup running at midnight, which briefly took the system offline.

Thanks for the great work!

Hi, thanks sharing.

I just did the update without any problem. My printer setting is A1 with AMS Lite.