🖨️ + 🏠 + 📊
Bambu Lab Home Assistant Integration: P1S, X1C, A1 Setup
Complete setup guide for automatic filament tracking
Step-by-step tutorial — no prior Home Assistant experience required
Skip Home Assistant: 3DPM Agent
No Home Assistant server and no MQTT setup. 3DPM Agent for Windows (Microsoft Store) books Bambu Lab, Prusa (PrusaLink) and Klipper (Moonraker) prints into 3D Print Manager and takes the grams off the right spools when a print starts; a stopped or failed print gets the unprinted part back. It is included in PRO and FARM. Sign up from this guide and PRO is free for 30 days, no card needed. Setup: chapter 7b of the user manual.
This guide is for printers you already run through Home Assistant and for other brands.
Overview
How does the 3DPM + HA connection work?
Before we start clicking buttons, it's worth understanding what we're actually building — so nothing seems like magic later.
The big picture
Your Bambu P1S printer is on your Wi-Fi network. Home Assistant (HA) connects to it and reads its status in real time — things like "is it printing right now?", "how many grams of filament does the current print use?", "how many minutes are left?".
When the printer's status changes (e.g. from idle to printing), HA fires an automation. That automation calls the 3DPM API — essentially sending a message like "hey, printer just started a 90-minute print using 45g of filament from slot 1". 3DPM receives that, creates a print job record, and deducts the filament from your inventory — all automatically.
Step-by-step data flow
Home Assistant
detects status change
Automation fires
reads sensor data
3DPM API
logs job & deducts
The 5 events we track
Start Print
Triggered when print status changes to running. HA waits a few seconds for the printer to enter the actual printing phase, then reads the filename, estimated duration, and filament weight — and sends all of that to 3DPM, which takes the grams off the mapped spools right away.
Finish Print
Triggered when the print finishes (finish) and closes the job. The grams came off the spools when the print started, so nothing more is deducted here.
Failed or Cancelled Print
Triggered when a print stops or fails (failed). 3DPM closes the job as failed and gives back the grams that were not printed, based on the last progress the printer reported.
Pause Print
Triggered when status changes to pause. Tells 3DPM the job is paused so it can update the status in the scheduler. This also enables the runout detection flow — if filament ran out, 3DPM will flag the job for a spool swap.
Resume Print
Triggered when status changes from pause back to running. HA waits for the AMS tray to be ready, then sends the new remaining time to 3DPM so the job timeline updates correctly.
What is the API key?
The API key is your personal password for the 3DPM API. It proves to 3DPM that the request is coming from your Home Assistant — not from someone else. You'll find it in 3DPM under . It looks like a long string of random letters and numbers, e.g. a8058e74d9d8ec984dd29293...
What is the Printer ID?
Each printer you add to 3DPM gets a unique UUID — a long ID that looks like b7b71ff0-1a91-11f1-b989-566fc143004c. This tells the API which printer is printing. You'll find it in 3DPM under .
Nothing gets installed on your printer. The P1S doesn't need any firmware modification. HA reads data through the Bambu Cloud or direct local connection — the same way the official Bambu Handy app works. 3DPM only reads this data — it never controls your printer: it does not start, stop, pause or send print jobs. Your slicer and the printer's own apps stay in charge of printing.
Before you start
What you need
- Home Assistant running (any install type)
- Bambu P1S on Wi-Fi
- Bambu account (email + password)
- 3DPM account (PRO or FARM plan)
- Printer added in 3DPM under Settings → Printers
- ~30 minutes of free time
HACS is the Home Assistant Community Store — an app store for unofficial integrations. The Bambu Lab integration lives here, so we need HACS first.
Install the Terminal add-on
- Go to
- Search for Terminal & SSH and install it
- Click Start then Open Web UI
Run the HACS installer
- In the terminal window, paste this exact command and press Enter:
wget -O - https://get.hacs.xyz | bash -
- Wait for green output lines — the install is done when you see
HACS is now installed
- Restart HA:
Activate HACS
- After restart go to
- Search for HACS and click it
- Accept the terms, then link your GitHub account when prompted (you need a free GitHub account)
Done when: A new HACS item appears in the left sidebar.
This integration makes HA understand your Bambu printer and creates sensor entities for everything it reports.
- Click HACS in the left sidebar
- Click the Integrations tab
- Click + Explore & Download Repositories
- Search:
Bambu Lab
- Select Bambu Lab by author greghesp
- Click Download → confirm
- Restart HA:
Check the author! The correct integration is by greghesp. There are forks — make sure you pick the right one.
- Go to
- Search for Bambu Lab and click it
- Choose connection mode:
☁️ Cloud (recommended for beginners)
Enter your Bambu account email and password. Works even if the printer is on a different network. Requires internet.
🏠 Local network
Enter the printer's IP address and Access Code (found in the printer's settings menu). Faster, no cloud dependency.
- Enter the required credentials and click Submit
- HA will find your P1S and create a device entry
Done when: You see a Bambu Lab card with your printer name under .
Every sensor the Bambu integration creates has a unique entity ID. The automations we'll write need these exact IDs. They follow a pattern:
sensor.p1s_SERIALNUMBER_sensor_name
The serial number part is unique to your printer — like 01p00a461800769.
How to find them
- Go to (in the HA left sidebar)
- In the filter box type:
p1s
- You'll see all your P1S sensors listed — their entity IDs are on the left
Alternatively: → click your printer → scroll through the sensor list and click any sensor to see its entity ID.
The 7 sensors you need
| Sensor | Entity ID ends with | Example value |
| Print status | _print_status | running, finish, pause, idle |
| Active AMS tray | _active_tray | attribute: tray_index = 0,1,2,3 |
| G-code filename | _gcode_file | model.3mf |
| Remaining time | _remaining_time | 90 (minutes) |
| Print weight | _print_weight | 45g |
| Print progress | _print_progress | 0–100 |
| Current stage | _current_stage | printing, prepare, idle |
Sensor name difference: The G-code filename sensor suffix is not the same for all models. P1S uses _gcode_file. P2S and A1 use _gcode_filename. For other models, check your actual entity ID directly in Home Assistant: go to , click your printer, and look for the G-code filename sensor.
Write down your entity IDs
# Fill in your serial number below — replace SERIAL with yours
print_status: sensor.p1s_SERIAL_print_status
active_tray: sensor.p1s_SERIAL_active_tray
gcode_file: sensor.p1s_SERIAL_gcode_file
remaining: sensor.p1s_SERIAL_remaining_time
weight: sensor.p1s_SERIAL_print_weight
progress: sensor.p1s_SERIAL_print_progress
stage: sensor.p1s_SERIAL_current_stage
File Editor lets you edit HA configuration files directly in the browser — no FTP or SSH needed.
- Go to
- Search for File editor and install it
- Enable Show in sidebar so it's always accessible
- Click Start then Open Web UI
You'll see a file tree on the left and a code editor on the right.
This file tells HA how to call the 3DPM API. We're adding 4 REST commands — one for each event (start, finish, pause, resume).
Open the file
- Open File Editor from the sidebar
- Click the folder icon (top left) → click configuration.yaml
Get your API key first
- Log into 3DPM
- Go to
- Copy your API key — it looks like a long random string
YAML indentation is critical! Use exactly 2 spaces per indent level — never tabs. If you misalign anything, HA won't start. The word rest_command: must be at the very beginning of a line (zero spaces before it).
Add to the end of configuration.yaml
Replace YOUR_API_KEY with the key you copied from 3DPM:
rest_command:
3dpm_start_print:
url: "https://3dprintmanager.eu/api.php?key=YOUR_API_KEY&action=start_print"
method: POST
headers:
content_type: 'application/json'
payload: >-
{
"printer_id": "{{ printer_id }}",
"job_name": "{{ job_name | replace('\"', '\\\"') }}",
"duration_minutes": {{ duration | int(0) }},
"mapping": {{ mapping | default('[]') }}
}
3dpm_finish_print:
url: "https://3dprintmanager.eu/api.php?key=YOUR_API_KEY&action=finish_print"
method: POST
headers:
content_type: 'application/json'
payload: >-
{
"printer_id": "{{ printer_id }}",
"slot": {{ slot | int(-1) }},
"amount_used": {{ amount | float(0) }},
"hours": {{ hours | float(0) }}
}
3dpm_fail_print:
url: "https://3dprintmanager.eu/api.php?key=YOUR_API_KEY&action=fail_print"
method: POST
headers:
content_type: 'application/json'
payload: >-
{
"printer_id": "{{ printer_id }}",
"progress": {{ progress | float(-1) }}
}
3dpm_pause_print:
url: "https://3dprintmanager.eu/api.php?key=YOUR_API_KEY&action=pause_print"
method: POST
headers:
content_type: 'application/json'
payload: >-
{
"printer_id": "{{ printer_id }}"
}
3dpm_resume_print:
url: "https://3dprintmanager.eu/api.php?key=YOUR_API_KEY&action=resume_print"
method: POST
headers:
content_type: 'application/json'
payload: >-
{
"printer_id": "{{ printer_id }}",
"slot": {{ slot | int(-1) }},
"duration_minutes": {{ duration | int(0) }}
}
Already have rest_command: in your file? Don't add a second one! Just paste the 5 commands inside the existing rest_command: block, keeping the same 2-space indent.
Save and validate
- Save the file (floppy icon)
- Go to
- If it shows "Configuration valid!" → proceed
- Restart HA:
Each automation watches for a specific printer event and calls the matching 3DPM REST command.
How to add each automation:
Go to → click + Create Automation → click Edit in YAML (top right corner) → delete everything → paste the code below → Save.
In every automation, replace the highlighted parts:
- sensor.p1s_SERIAL_* → your actual entity IDs from Step 4
- YOUR_PRINTER_UUID → the Printer ID from 3DPM ()
Automation 1 — Start Print
Fires when the printer starts. Sends job name, estimated duration, and filament weight to 3DPM.
alias: "3DPM: Start Print"
description: Reports new print job to 3DPM when P1S starts printing
triggers:
- entity_id: sensor.p1s_SERIAL_print_status
to: running
trigger: state
conditions:
- condition: template
value_template: "{{ trigger.from_state.state != 'pause' }}"
actions:
- wait_template: "{{ states('sensor.p1s_SERIAL_current_stage') | lower == 'printing' }}"
timeout: "00:15:00"
continue_on_timeout: false
- delay: "00:00:05"
- action: rest_command.3dpm_start_print
data:
printer_id: "YOUR_PRINTER_UUID"
job_name: "{{ states('sensor.p1s_SERIAL_gcode_file').split('/')[-1] }}"
duration: "{{ (states('sensor.p1s_SERIAL_remaining_time') | float(0) * 60) | round(0) }}"
mapping: >-
{% set tray_idx = state_attr('sensor.p1s_SERIAL_active_tray', 'tray_index') | int(-1) %}
{% set slot = 0 if tray_idx in [254, -1] else tray_idx + 1 %}
{% set weight_val = states('sensor.p1s_SERIAL_print_weight') | replace('g', '') | trim | float(0) | round(2) %}
[{"slot": {{ slot }}, "weight": {{ weight_val }}}]
mode: single
The conditions block prevents this from firing when a print resumes from pause — the Resume automation handles that separately.
Automation 2 — Finish Print
Fires when a print finishes. The grams were already taken from the spools when the print started; this closes the job and logs the hours. A stopped or failed print goes through Automation 2b instead.
alias: "3DPM: Finish Print"
description: Closes the job in 3DPM when the print finishes (grams were deducted at start)
triggers:
- entity_id: sensor.p1s_SERIAL_print_status
to: finish
trigger: state
actions:
- action: rest_command.3dpm_finish_print
data:
printer_id: "YOUR_PRINTER_UUID"
slot: >-
{% set tray_idx = state_attr('sensor.p1s_SERIAL_active_tray', 'tray_index') | int(-1) %}
{{ 0 if tray_idx in [254, -1] else tray_idx + 1 }}
amount: >-
{% set total_w = states('sensor.p1s_SERIAL_print_weight') | replace('g', '') | trim | float(0) %}
{% set prog = states('sensor.p1s_SERIAL_print_progress') | float(100) %}
{{ (total_w * (prog / 100)) | round(2) }}
hours: 0
mode: single
Automation 2b — Failed or Cancelled Print
A print you stop on the printer, or one that fails, arrives as failed. 3DPM gives back the filament that was not printed, using the progress the printer reported.
alias: "3DPM: Failed or Cancelled Print"
description: Returns unused filament to the spool when a print is cancelled or fails
triggers:
- entity_id: sensor.p1s_SERIAL_print_status
to: failed
trigger: state
actions:
- action: rest_command.3dpm_fail_print
data:
printer_id: "YOUR_PRINTER_UUID"
progress: "{{ states('sensor.p1s_SERIAL_print_progress') | float(-1) }}"
mode: single
Automation 3 — Pause Print
Fires when the printer pauses (e.g. filament runout). Notifies 3DPM to pause the job.
alias: "3DPM: Pause Print"
description: Notifies 3DPM that the print is paused
triggers:
- entity_id: sensor.p1s_SERIAL_print_status
to: pause
trigger: state
actions:
- action: rest_command.3dpm_pause_print
data:
printer_id: "YOUR_PRINTER_UUID"
mode: single
Automation 4 — Resume Print
Fires when print resumes from pause. Waits for AMS tray to be ready, then updates remaining time in 3DPM.
alias: "3DPM: Resume Print"
description: Notifies 3DPM that print has resumed, with updated remaining time
triggers:
- entity_id: sensor.p1s_SERIAL_print_status
from: pause
to: running
trigger: state
actions:
- wait_template: "{{ state_attr('sensor.p1s_SERIAL_active_tray', 'tray_index') | int(-1) >= 0 }}"
timeout: "00:05:00"
continue_on_timeout: true
- delay: "00:00:05"
- action: rest_command.3dpm_resume_print
data:
printer_id: "YOUR_PRINTER_UUID"
slot: >-
{% set tray_idx = state_attr('sensor.p1s_SERIAL_active_tray', 'tray_index') | int(-1) %}
{{ 0 if tray_idx in [254, -1] else tray_idx + 1 }}
duration: "{{ (states('sensor.p1s_SERIAL_remaining_time') | float(0) * 60) | round(0) }}"
mode: single
Quick test — call the API manually
- Go to
- In the Service field type:
rest_command.3dpm_start_print
- In Service data paste:
printer_id: "YOUR_PRINTER_UUID"
job_name: "test_api_call"
duration: "30"
mapping: '[{"slot": 1, "weight": 5}]'
- Click Call Service
- Open 3DPM → check the scheduler — you should see a test job appear ✅
Real print test
- Start a print on your P1S from Bambu Studio or the Handy app
- In HA go to
- You should see a green trace entry — that means it fired ✅
- Check 3DPM — the print should be visible in the scheduler ✅
- When the print finishes, verify the filament weight decreased on the spool ✅
Everything working? Your printer is now fully connected. Every print automatically tracks filament usage in 3DPM.
Common issues
| Problem | Fix |
| REST command returns error | Double-check your API key in configuration.yaml — no extra spaces |
| Automation doesn't fire | Check entity ID in Developer Tools → States. Make sure print_status actually changes value when printing |
| HA won't start after editing | YAML indentation error. Run Configuration Check, look for the error line |
| Grams not deducted | Check Finish Print automation Traces — did it run? Is the printer_id correct? |
🖨️ + 🏠 + 📊
Bambu Lab i Home Assistant: postavljanje za P1S, X1C, A1
Kompletni vodič za automatsko praćenje filamenta
Korak po korak — ne treba prethodno iskustvo s Home Assistantom
Bez Home Assistanta: 3DPM Agent
Bez Home Assistant servera i bez MQTT postavki. 3DPM Agent za Windows (Microsoft Store) knjiži printove s Bambu Lab, Prusa (PrusaLink) i Klipper (Moonraker) printera u 3D Print Manager i skida grame s pravih rola kad print krene; zaustavljeni ili neuspjeli print dobiva neisprintani dio natrag. Uključen je u PRO i FARM. Registrirajte se iz ovog vodiča i PRO je 30 dana besplatan, bez kartice. Postavljanje: poglavlje 7b korisničkog priručnika.
Ovaj vodič je za printere koje već vodite kroz Home Assistant i za ostale marke.
Pregled
Kako funkcionira veza 3DPM + HA?
Prije nego počnemo klikati, vrijedi razumjeti što zapravo gradimo — da nam ništa ne izgleda kao magija.
Velika slika
Tvoj Bambu P1S je na Wi-Fi mreži. Home Assistant (HA) se spaja na njega i čita status u realnom vremenu — stvari poput "tiska li trenutno?", "koliko grama filamenta koristi ovaj print?", "koliko minuta je ostalo?".
Kada se status printera promijeni (npr. s idle na running), HA pokreće automatizaciju. Ta automatizacija poziva 3DPM API — praktički šalje poruku "hej, printer upravo je počeo 90-minutni print koji troši 45g filamenta iz slota 1". 3DPM to prima, kreira zapis o printu i skida filament iz inventara — sve automatski.
Tok podataka korak po korak
Home Assistant
detektira promjenu
Automatizacija
čita podatke senzora
3DPM API
bilježi i skida grame
5 događaja koja pratimo
Start Print
Aktivira se kad status prijeđe na running. HA pričeka nekoliko sekundi da printer uđe u fazu printanja, zatim čita naziv fajla, procijenjeno trajanje i težinu filamenta — i sve to šalje 3DPM-u, koji odmah skida grame s mapiranih rola.
Finish Print
Aktivira se kad print završi (finish) i zatvara posao. Grami su skinuti s rola već na startu, pa se ovdje ništa više ne skida.
Neuspjeli ili otkazani print
Aktivira se kad se print zaustavi ili ne uspije (failed). 3DPM zatvara posao kao neuspio i vraća na rolu grame koji nisu isprintani, prema zadnjem napretku koji je printer javio.
Pause Print
Aktivira se kad status prijeđe na pause. Obavještava 3DPM da je print pauziran. Ovo je važno za detekciju nestanka filamenta — 3DPM će označiti job za zamjenu role.
Resume Print
Aktivira se kad status prijeđe iz pause natrag na running. HA čeka da AMS tray bude spreman, zatim šalje novo preostalo vrijeme 3DPM-u da se timeline schedulera ispravno ažurira.
Što je API ključ?
API ključ je tvoja osobna lozinka za 3DPM API. Dokazuje 3DPM-u da zahtjev dolazi s tvog Home Assistanta — a ne od nekog drugog. Naći ćeš ga u 3DPM pod . Izgleda kao dugački niz slučajnih znakova, npr. a8058e74d9d8ec984dd29293...
Što je Printer ID?
Svaki printer koji dodaš u 3DPM dobiva jedinstveni UUID — dugi ID koji izgleda poput b7b71ff0-1a91-11f1-b989-566fc143004c. To govori API-ju koji printer printa. Naći ćeš ga u 3DPM pod .
Na printeru se ništa ne instalira. P1S ne treba nikakvu izmjenu firmwarea. HA čita podatke kroz Bambu Cloud ili direktnu lokalnu konekciju — isti način kao službena Bambu Handy aplikacija. 3DPM samo čita te podatke — nikada ne upravlja printerom: ne pokreće, ne zaustavlja, ne pauzira niti šalje poslove. Vaš slicer i printerove aplikacije ostaju zaduženi za printanje.
Prije početka
Što ti treba
- Pokrenut Home Assistant (bilo koji tip instalacije)
- Bambu P1S na Wi-Fi mreži
- Bambu račun (email + lozinka)
- 3DPM račun (PRO ili FARM plan)
- Printer dodan u 3DPM pod Settings → Printers
- ~30 minuta slobodnog vremena
HACS je community app store za HA. Bez njega ne možeš instalirati Bambu Lab integraciju.
Instaliraj Terminal add-on
- Idi na
- Traži Terminal & SSH i instaliraj
- Klikni Start pa Open Web UI
Pokreni HACS installer
- U terminal prozoru zalijepi ovu naredbu i pritisni Enter:
wget -O - https://get.hacs.xyz | bash -
- Pričekaj zelene poruke — gotovo kad vidiš
HACS is now installed
- Restart HA:
Aktiviraj HACS
- Idi na
- Traži HACS i klikni
- Prihvati uvjete i poveži GitHub račun (treba besplatni GitHub račun)
Gotovo kad: U lijevom izborniku se pojavi stavka HACS.
- Klikni HACS u izborniku
- Klikni Integrations tab
- Klikni + Explore & Download Repositories
- Traži:
Bambu Lab
- Odaberi Bambu Lab od autora greghesp
- Klikni Download → potvrdi
- Restart HA
Provjeri autora! Ispravna integracija je od greghesp. Postoje kopije — uzmi pravu.
- Idi na
- Traži Bambu Lab i klikni
- Bira se način spajanja: Cloud (upiši email i lozinku Bambu računa) ili Local (upiši IP adresu i Access Code printera)
- Preporučujemo Cloud za početnike — samo email i lozinka pa gotovo
- Unesi podatke i klikni Submit
Gotovo kad: Pod se pojavi kartica s imenom tvog printera.
Svaki senzor ima jedinstveni ID oblika: sensor.p1s_SERIJSKIBROJ_naziv_senzora
Kako pronaći
- Idi na
- U filter upiši
p1s
- Vidiš sve senzore svog P1S printera s njihovim entity ID-ovima
| Senzor | Završava s |
| Status printa | _print_status |
| Aktivni AMS tray | _active_tray |
| Naziv G-code fajla | _gcode_file |
| Preostalo vrijeme | _remaining_time |
| Težina filamenta | _print_weight |
| Napredak (%) | _print_progress |
| Trenutna faza | _current_stage |
Razlika u nazivu senzora: Sufiks G-code senzora nije isti za sve modele. P1S koristi _gcode_file. P2S i A1 koriste _gcode_filename. Za ostale modele provjeri pravi entity ID direktno u Home Assistantu: idi na , klikni svoj printer i potraži senzor naziva G-code datoteke.
- Idi na
- Traži File editor i instaliraj
- Uključi Show in sidebar
- Klikni Start pa Open Web UI
Vidjet ćeš stablo fajlova i uređivač koda.
Ovaj fajl govori HA-u kako zvati 3DPM API. Dodajemo 4 REST komande.
API ključ
- U 3DPM idi na
- Kopiraj API ključ
Otvori fajl
- U File Editoru klikni ikonu foldera → klikni configuration.yaml
Indentacija je kritična! Koristi točno 2 razmaka po razini, nikad Tab. Riječ rest_command: mora biti na samom početku retka (nula razmaka ispred).
Dodaj na kraj fajla
Zamijeni TVOJ_API_KLJUČ s ključem iz 3DPM:
rest_command:
3dpm_start_print:
url: "https://3dprintmanager.eu/api.php?key=TVOJ_API_KLJUČ&action=start_print"
method: POST
headers:
content_type: 'application/json'
payload: >-
{
"printer_id": "{{ printer_id }}",
"job_name": "{{ job_name | replace('\"', '\\\"') }}",
"duration_minutes": {{ duration | int(0) }},
"mapping": {{ mapping | default('[]') }}
}
3dpm_finish_print:
url: "https://3dprintmanager.eu/api.php?key=TVOJ_API_KLJUČ&action=finish_print"
method: POST
headers:
content_type: 'application/json'
payload: >-
{
"printer_id": "{{ printer_id }}",
"slot": {{ slot | int(-1) }},
"amount_used": {{ amount | float(0) }},
"hours": {{ hours | float(0) }}
}
3dpm_fail_print:
url: "https://3dprintmanager.eu/api.php?key=TVOJ_API_KLJUČ&action=fail_print"
method: POST
headers:
content_type: 'application/json'
payload: >-
{
"printer_id": "{{ printer_id }}",
"progress": {{ progress | float(-1) }}
}
3dpm_pause_print:
url: "https://3dprintmanager.eu/api.php?key=TVOJ_API_KLJUČ&action=pause_print"
method: POST
headers:
content_type: 'application/json'
payload: >-
{
"printer_id": "{{ printer_id }}"
}
3dpm_resume_print:
url: "https://3dprintmanager.eu/api.php?key=TVOJ_API_KLJUČ&action=resume_print"
method: POST
headers:
content_type: 'application/json'
payload: >-
{
"printer_id": "{{ printer_id }}",
"slot": {{ slot | int(-1) }},
"duration_minutes": {{ duration | int(0) }}
}
Spremi i provjeri
- Spremi fajl
- Idi na
- Ako piše "Configuration valid!" — restart HA
Već imaš rest_command: u fajlu? Ne dodavaj novi! Samo dodaj 5 komandi unutar postojećeg bloka s istim uvlakom.
Kako dodati: → klikni Edit in YAML (gore desno) → izbriši sve → zalijepi kod → Spremi.
U svakoj automatizaciji zamijeni sensor.p1s_SERIAL_* s tvojim entity ID-ovima iz Koraka 4, i UUID_PRINTERA s Printer ID-om iz 3DPM.
Automatizacija 1 — Start Print
alias: "3DPM: Start Print"
description: Prijavljuje novi print 3DPM-u kad P1S počne printati
triggers:
- entity_id: sensor.p1s_SERIAL_print_status
to: running
trigger: state
conditions:
- condition: template
value_template: "{{ trigger.from_state.state != 'pause' }}"
actions:
- wait_template: "{{ states('sensor.p1s_SERIAL_current_stage') | lower == 'printing' }}"
timeout: "00:15:00"
continue_on_timeout: false
- delay: "00:00:05"
- action: rest_command.3dpm_start_print
data:
printer_id: "UUID_PRINTERA"
job_name: "{{ states('sensor.p1s_SERIAL_gcode_file').split('/')[-1] }}"
duration: "{{ (states('sensor.p1s_SERIAL_remaining_time') | float(0) * 60) | round(0) }}"
mapping: >-
{% set tray_idx = state_attr('sensor.p1s_SERIAL_active_tray', 'tray_index') | int(-1) %}
{% set slot = 0 if tray_idx in [254, -1] else tray_idx + 1 %}
{% set weight_val = states('sensor.p1s_SERIAL_print_weight') | replace('g', '') | trim | float(0) | round(2) %}
[{"slot": {{ slot }}, "weight": {{ weight_val }}}]
mode: single
Automatizacija 2 — Finish Print
alias: "3DPM: Finish Print"
description: Zatvara posao u 3DPM-u kad print završi (grami su skinuti na startu)
triggers:
- entity_id: sensor.p1s_SERIAL_print_status
to: finish
trigger: state
actions:
- action: rest_command.3dpm_finish_print
data:
printer_id: "UUID_PRINTERA"
slot: >-
{% set tray_idx = state_attr('sensor.p1s_SERIAL_active_tray', 'tray_index') | int(-1) %}
{{ 0 if tray_idx in [254, -1] else tray_idx + 1 }}
amount: >-
{% set total_w = states('sensor.p1s_SERIAL_print_weight') | replace('g', '') | trim | float(0) %}
{% set prog = states('sensor.p1s_SERIAL_print_progress') | float(100) %}
{{ (total_w * (prog / 100)) | round(2) }}
hours: 0
mode: single
Automatizacija 2b — Neuspjeli ili otkazani print
Print koji zaustaviš na printeru, ili koji ne uspije, stiže kao failed. 3DPM vraća na rolu filament koji nije isprintan, prema napretku koji je printer javio.
alias: "3DPM: Failed or Cancelled Print"
description: Vraća neisprintani filament na rolu kad je print otkazan ili neuspio
triggers:
- entity_id: sensor.p1s_SERIAL_print_status
to: failed
trigger: state
actions:
- action: rest_command.3dpm_fail_print
data:
printer_id: "UUID_PRINTERA"
progress: "{{ states('sensor.p1s_SERIAL_print_progress') | float(-1) }}"
mode: single
Automatizacija 3 — Pause Print
alias: "3DPM: Pause Print"
description: Javlja 3DPM-u da je print pauziran
triggers:
- entity_id: sensor.p1s_SERIAL_print_status
to: pause
trigger: state
actions:
- action: rest_command.3dpm_pause_print
data:
printer_id: "UUID_PRINTERA"
mode: single
Automatizacija 4 — Resume Print
alias: "3DPM: Resume Print"
description: Javlja 3DPM-u da se print nastavlja s novim preostalim vremenom
triggers:
- entity_id: sensor.p1s_SERIAL_print_status
from: pause
to: running
trigger: state
actions:
- wait_template: "{{ state_attr('sensor.p1s_SERIAL_active_tray', 'tray_index') | int(-1) >= 0 }}"
timeout: "00:05:00"
continue_on_timeout: true
- delay: "00:00:05"
- action: rest_command.3dpm_resume_print
data:
printer_id: "UUID_PRINTERA"
slot: >-
{% set tray_idx = state_attr('sensor.p1s_SERIAL_active_tray', 'tray_index') | int(-1) %}
{{ 0 if tray_idx in [254, -1] else tray_idx + 1 }}
duration: "{{ (states('sensor.p1s_SERIAL_remaining_time') | float(0) * 60) | round(0) }}"
mode: single
Brzi test — pozovi API ručno
- Idi na
- Service:
rest_command.3dpm_start_print
- Service data:
printer_id: "UUID_PRINTERA"
job_name: "test_poziv"
duration: "30"
mapping: '[{"slot": 1, "weight": 5}]'
- Klikni Call Service → provjeri u 3DPM je li se pojavio testni job ✅
Pravi test
- Pokreni print na P1S normalno (iz Bambu Studio ili Handy app)
- U HA provjeri: — vidiš li zeleni trace? ✅
- U 3DPM je li vidljiv print u scheduleru? ✅
- Kad print završi — je li se gramaza role smanjila? ✅
Sve radi? Čestitamo! Od sad svaki print automatski ažurira stanje filamenta.
Česti problemi
| Problem | Rješenje |
| REST komanda vraća grešku | Provjeri API ključ — bez razmaka |
| Automatizacija se ne pokreće | Provjeri entity ID u Developer Tools → States |
| HA ne starta nakon edita | Greška u YAML indentaciji — pokreni Configuration Check |
| Grami se ne odbijaju | Provjeri Finish Print Traces i Printer ID |
🖨️ + 🏠 + 📊
Bambu Lab mit Home Assistant: Einrichtung für P1S, X1C, A1
Vollständige Anleitung für automatisches Filament-Tracking
Schritt für Schritt — keine Vorkenntnisse mit Home Assistant erforderlich
Ohne Home Assistant: 3DPM Agent
Kein Home-Assistant-Server und keine MQTT-Einrichtung. 3DPM Agent für Windows (Microsoft Store) bucht Drucke von Bambu-Lab-, Prusa- (PrusaLink) und Klipper-Druckern (Moonraker) in 3D Print Manager und zieht die Gramm beim Druckstart von den richtigen Rollen ab; ein gestoppter oder fehlgeschlagener Druck bekommt den nicht gedruckten Teil zurück. Er ist in PRO und FARM enthalten. Registrieren Sie sich über diese Anleitung und PRO ist 30 Tage kostenlos, ohne Karte. Einrichtung: Kapitel 7b des Benutzerhandbuchs.
Diese Anleitung ist für Drucker, die Sie bereits über Home Assistant betreiben, und für andere Marken.
Überblick
Wie funktioniert die 3DPM + HA Verbindung?
Bevor wir anfangen zu klicken, lohnt es sich zu verstehen, was wir eigentlich aufbauen.
Das große Bild
Dein Bambu P1S ist im WLAN. Home Assistant (HA) verbindet sich damit und liest den Status in Echtzeit — Dinge wie "druckt es gerade?", "wie viele Gramm Filament verbraucht dieser Druck?", "wie viele Minuten sind noch übrig?".
Wenn sich der Status des Druckers ändert (z.B. von Leerlauf auf Drucken), löst HA eine Automatisierung aus. Diese Automatisierung ruft die 3DPM API auf — sendet eine Nachricht wie "Hey, der Drucker hat gerade einen 90-minütigen Druck mit 45g Filament aus Slot 1 gestartet". 3DPM empfängt das, erstellt einen Druckauftrag und zieht das Filament vom Inventar ab — vollautomatisch.
Datenfluss Schritt für Schritt
Home Assistant
erkennt Statusänderung
Automatisierung
liest Sensordaten
3DPM API
speichert & zieht ab
Die 5 Ereignisse, die wir verfolgen
Druck starten
Ausgelöst wenn Status auf running wechselt. HA wartet kurz, liest Dateiname, geschätzte Dauer und Filamentgewicht — und sendet alles an 3DPM, das die Gramm sofort von den zugeordneten Rollen abzieht.
Druck beenden
Ausgelöst, wenn der Druck fertig ist (finish), und schließt den Auftrag ab. Die Gramm wurden schon beim Start abgezogen, hier wird nichts mehr abgebucht.
Fehlgeschlagener oder abgebrochener Druck
Ausgelöst, wenn ein Druck gestoppt wird oder fehlschlägt (failed). 3DPM schließt den Auftrag als fehlgeschlagen und bucht die nicht gedruckten Gramm nach dem zuletzt gemeldeten Fortschritt zurück.
Druck pausieren
Ausgelöst wenn Status auf pause wechselt. Benachrichtigt 3DPM dass der Auftrag pausiert ist — wichtig für Filament-Runout-Erkennung.
Druck fortsetzen
Ausgelöst wenn Status von pause zurück auf running wechselt. Sendet neue verbleibende Zeit an 3DPM damit der Zeitplan korrekt aktualisiert wird.
Was ist der API-Schlüssel?
Der API-Schlüssel ist dein persönliches Passwort für die 3DPM API. Du findest ihn in 3DPM unter . Er sieht aus wie ein langer zufälliger String, z.B. a8058e74d9d8ec984dd29293...
Was ist die Drucker-ID?
Jeder in 3DPM hinzugefügte Drucker bekommt eine eindeutige UUID — eine lange ID wie b7b71ff0-1a91-11f1-b989-566fc143004c. Du findest sie in 3DPM unter .
Am Drucker wird nichts installiert. Der P1S benötigt keine Firmware-Änderung. HA liest Daten über die Bambu Cloud oder direkte lokale Verbindung — genauso wie die offizielle Bambu Handy App. 3DPM liest diese Daten nur — es steuert Ihren Drucker nie: es startet, stoppt, pausiert oder sendet keine Druckaufträge. Ihr Slicer und die Drucker-Apps bleiben für das Drucken zuständig.
Voraussetzungen
Was du brauchst
- Home Assistant läuft (beliebiger Installationstyp)
- Bambu P1S im WLAN
- Bambu-Konto (E-Mail + Passwort)
- 3DPM-Konto (PRO oder FARM-Plan)
- Drucker in 3DPM unter Settings → Printers hinzugefügt
- ~30 Minuten Zeit
- Gehe zu
- Suche Terminal & SSH und installiere es
- Klicke Start dann Open Web UI
- Im Terminal-Fenster diesen Befehl eingeben und Enter drücken:
wget -O - https://get.hacs.xyz | bash -
- Warte auf grüne Ausgabe — fertig wenn
HACS is now installed erscheint
- HA neu starten:
- Gehe zu
- Suche HACS, akzeptiere die Bedingungen, verknüpfe GitHub-Konto
Fertig wenn: HACS in der linken Seitenleiste erscheint.
- Klicke HACS in der Seitenleiste → Tab Integrations
- Klicke + Explore & Download Repositories
- Suche:
Bambu Lab → wähle Bambu Lab von greghesp
- Klicke Download → bestätigen → HA neu starten
Autor prüfen! Die richtige Integration ist von greghesp.
- Gehe zu
- Suche Bambu Lab und klicke darauf
- Wähle Cloud (empfohlen für Anfänger — E-Mail + Passwort des Bambu-Kontos eingeben) oder Local (IP-Adresse + Access Code des Druckers)
- Daten eingeben und Submit klicken
Fertig wenn: Eine Karte mit dem Druckernamen unter erscheint.
Jeder Sensor hat eine eindeutige ID nach dem Muster: sensor.p1s_SERIENNUMMER_sensor_name
- Gehe zu
- Im Filter-Feld
p1s eingeben
- Alle P1S-Sensoren mit ihren Entity-IDs werden angezeigt
| Sensor | Entity-ID endet mit |
| Druckstatus | _print_status |
| Aktives AMS-Fach | _active_tray |
| G-Code Dateiname | _gcode_file |
| Verbleibende Zeit | _remaining_time |
| Filamentgewicht | _print_weight |
| Druckfortschritt (%) | _print_progress |
| Aktuelle Phase | _current_stage |
Unterschied im Sensornamen: Das Suffix des G-Code-Sensors ist nicht bei allen Modellen gleich. P1S verwendet _gcode_file. P2S und A1 verwenden _gcode_filename. Bei anderen Modellen prüfe die tatsächliche Entity-ID direkt in Home Assistant: → Drucker anklicken → nach dem G-Code-Dateinamen-Sensor suchen.
- Gehe zu
- Suche File editor → installieren
- Show in sidebar aktivieren → Start → Open Web UI
- API-Schlüssel in 3DPM kopieren:
- Im File Editor configuration.yaml öffnen
Einrückung ist entscheidend! Genau 2 Leerzeichen pro Ebene — nie Tabs. rest_command: muss am Zeilenanfang stehen (null Leerzeichen davor).
Ans Ende der Datei anfügen — DEIN_API_SCHLÜSSEL ersetzen:
rest_command:
3dpm_start_print:
url: "https://3dprintmanager.eu/api.php?key=DEIN_API_SCHLÜSSEL&action=start_print"
method: POST
headers:
content_type: 'application/json'
payload: >-
{
"printer_id": "{{ printer_id }}",
"job_name": "{{ job_name | replace('\"', '\\\"') }}",
"duration_minutes": {{ duration | int(0) }},
"mapping": {{ mapping | default('[]') }}
}
3dpm_finish_print:
url: "https://3dprintmanager.eu/api.php?key=DEIN_API_SCHLÜSSEL&action=finish_print"
method: POST
headers:
content_type: 'application/json'
payload: >-
{
"printer_id": "{{ printer_id }}",
"slot": {{ slot | int(-1) }},
"amount_used": {{ amount | float(0) }},
"hours": {{ hours | float(0) }}
}
3dpm_fail_print:
url: "https://3dprintmanager.eu/api.php?key=DEIN_API_SCHLÜSSEL&action=fail_print"
method: POST
headers:
content_type: 'application/json'
payload: >-
{
"printer_id": "{{ printer_id }}",
"progress": {{ progress | float(-1) }}
}
3dpm_pause_print:
url: "https://3dprintmanager.eu/api.php?key=DEIN_API_SCHLÜSSEL&action=pause_print"
method: POST
headers:
content_type: 'application/json'
payload: >-
{
"printer_id": "{{ printer_id }}"
}
3dpm_resume_print:
url: "https://3dprintmanager.eu/api.php?key=DEIN_API_SCHLÜSSEL&action=resume_print"
method: POST
headers:
content_type: 'application/json'
payload: >-
{
"printer_id": "{{ printer_id }}",
"slot": {{ slot | int(-1) }},
"duration_minutes": {{ duration | int(0) }}
}
- Datei speichern →
- Bei "Configuration valid!" → HA neu starten
So hinzufügen: → Edit in YAML (oben rechts) → alles löschen → Code einfügen → Speichern.
sensor.p1s_SERIAL_* durch deine Entity-IDs ersetzen, UUID_DRUCKER durch die Drucker-ID aus 3DPM.
Automatisierung 1 — Druck starten
alias: "3DPM: Start Print"
description: Meldet neuen Druckauftrag an 3DPM wenn P1S zu drucken beginnt
triggers:
- entity_id: sensor.p1s_SERIAL_print_status
to: running
trigger: state
conditions:
- condition: template
value_template: "{{ trigger.from_state.state != 'pause' }}"
actions:
- wait_template: "{{ states('sensor.p1s_SERIAL_current_stage') | lower == 'printing' }}"
timeout: "00:15:00"
continue_on_timeout: false
- delay: "00:00:05"
- action: rest_command.3dpm_start_print
data:
printer_id: "UUID_DRUCKER"
job_name: "{{ states('sensor.p1s_SERIAL_gcode_file').split('/')[-1] }}"
duration: "{{ (states('sensor.p1s_SERIAL_remaining_time') | float(0) * 60) | round(0) }}"
mapping: >-
{% set tray_idx = state_attr('sensor.p1s_SERIAL_active_tray', 'tray_index') | int(-1) %}
{% set slot = 0 if tray_idx in [254, -1] else tray_idx + 1 %}
{% set weight_val = states('sensor.p1s_SERIAL_print_weight') | replace('g', '') | trim | float(0) | round(2) %}
[{"slot": {{ slot }}, "weight": {{ weight_val }}}]
mode: single
Automatisierung 2 — Druck beenden
alias: "3DPM: Finish Print"
description: Schließt den Auftrag in 3DPM ab, wenn der Druck endet (Gramm wurden beim Start abgezogen)
triggers:
- entity_id: sensor.p1s_SERIAL_print_status
to: finish
trigger: state
actions:
- action: rest_command.3dpm_finish_print
data:
printer_id: "UUID_DRUCKER"
slot: >-
{% set tray_idx = state_attr('sensor.p1s_SERIAL_active_tray', 'tray_index') | int(-1) %}
{{ 0 if tray_idx in [254, -1] else tray_idx + 1 }}
amount: >-
{% set total_w = states('sensor.p1s_SERIAL_print_weight') | replace('g', '') | trim | float(0) %}
{% set prog = states('sensor.p1s_SERIAL_print_progress') | float(100) %}
{{ (total_w * (prog / 100)) | round(2) }}
hours: 0
mode: single
Automatisierung 2b — Fehlgeschlagener oder abgebrochener Druck
Ein am Drucker gestoppter oder fehlgeschlagener Druck kommt als failed an. 3DPM bucht das nicht gedruckte Filament anhand des gemeldeten Fortschritts auf die Spule zurück.
alias: "3DPM: Failed or Cancelled Print"
description: Bucht nicht gedrucktes Filament zurück, wenn ein Druck abgebrochen wird oder fehlschlägt
triggers:
- entity_id: sensor.p1s_SERIAL_print_status
to: failed
trigger: state
actions:
- action: rest_command.3dpm_fail_print
data:
printer_id: "UUID_DRUCKER"
progress: "{{ states('sensor.p1s_SERIAL_print_progress') | float(-1) }}"
mode: single
Automatisierung 3 — Druck pausieren
alias: "3DPM: Pause Print"
description: Benachrichtigt 3DPM dass der Druck pausiert ist
triggers:
- entity_id: sensor.p1s_SERIAL_print_status
to: pause
trigger: state
actions:
- action: rest_command.3dpm_pause_print
data:
printer_id: "UUID_DRUCKER"
mode: single
Automatisierung 4 — Druck fortsetzen
alias: "3DPM: Resume Print"
description: Benachrichtigt 3DPM dass der Druck mit aktualisierter verbleibender Zeit fortgesetzt wird
triggers:
- entity_id: sensor.p1s_SERIAL_print_status
from: pause
to: running
trigger: state
actions:
- wait_template: "{{ state_attr('sensor.p1s_SERIAL_active_tray', 'tray_index') | int(-1) >= 0 }}"
timeout: "00:05:00"
continue_on_timeout: true
- delay: "00:00:05"
- action: rest_command.3dpm_resume_print
data:
printer_id: "UUID_DRUCKER"
slot: >-
{% set tray_idx = state_attr('sensor.p1s_SERIAL_active_tray', 'tray_index') | int(-1) %}
{{ 0 if tray_idx in [254, -1] else tray_idx + 1 }}
duration: "{{ (states('sensor.p1s_SERIAL_remaining_time') | float(0) * 60) | round(0) }}"
mode: single
Schnelltest — API manuell aufrufen
- Gehe zu
- Service:
rest_command.3dpm_start_print
- Service data:
printer_id: "UUID_DRUCKER"
job_name: "api_test"
duration: "30"
mapping: '[{"slot": 1, "weight": 5}]'
- Klicke Call Service → in 3DPM prüfen ob ein Testauftrag erscheint ✅
Alles funktioniert? Ab jetzt wird jeder Druck automatisch im 3DPM verfolgt.
Häufige Probleme
| Problem | Lösung |
| REST-Befehl gibt Fehler zurück | API-Schlüssel in configuration.yaml prüfen — keine Leerzeichen |
| Automatisierung löst nicht aus | Entity-ID in Developer Tools → States prüfen |
| HA startet nicht nach Bearbeitung | YAML-Einrückungsfehler — Configuration Check ausführen |
| Gramm werden nicht abgezogen | Finish Print Traces prüfen — ist die Drucker-ID korrekt? |
3D Print Manager — Home Assistant Integration Guide
3dprintmanager.eu