Bambu Lab 3D Printer Integraton

Hello together,

maybe today i can finally give something back to the great openhab community, at least to all that own a bambu lab 3D printer.

This week I recognized that there is a bambu lab printer integration for home assistant. Its realized over mqtt so not too difficult to integrate into openhab.

I own a X1C but settings should be quite same for the other models.

So let come the the interessting part. The X1C is an own Mqtt Broker.
Whats necessary:

  • access code (can be found in printer panel unter network)
  • serial number (also in the printer panel under device informations)
  • IP address

Im working with text configuration. Yet i only realized one item but the rest should be easy.


Bridge mqtt:broker:bambuX1C "Bambu X1C Broker" [    host="YOUR_IP", 
                                                    password="ACCESS CODE"

Thing mqtt:topic:stats "Bambu X1C stats" (mqtt:broker:bambuX1C) {   
        Type string : gcode_state "Status"  [stateTopic="device/SERIALNUMBER/report", transformationPattern="JSONPATH:$.print.gcode_state"]


String bambuX1C_Status "X1C Status" {channel="mqtt:topic:stats:gcode_state"}

In homeassistant they do a lot of transforming by node red. I think maybe the only difficult thing left ist to find out what has to be send for commands to the printer.
All available informations can be found in this example protocoll:

    "print": {
        "ams": {
            "ams": [
                    "humidity": "5",
                    "id": "0",
                    "temp": "-40.0",
                    "tray": [
                            "bed_temp": "0",
                            "bed_temp_type": "0",
                            "drying_temp": "0",
                            "drying_time": "0",
                            "id": "0",
                            "nozzle_temp_max": "260",
                            "nozzle_temp_min": "220",
                            "remain": -1,
                            "tag_uid": "0000000000000000",
                            "tray_color": "FFFFFFFF",
                            "tray_diameter": "0.00",
                            "tray_id_name": "",
                            "tray_info_idx": "GFG99",
                            "tray_sub_brands": "",
                            "tray_type": "PETG",
                            "tray_uuid": "00000000000000000000000000000000",
                            "tray_weight": "0",
                            "xcam_info": "000000000000000000000000"
                            "bed_temp": "0",
                            "bed_temp_type": "0",
                            "drying_temp": "0",
                            "drying_time": "0",
                            "id": "1",
                            "nozzle_temp_max": "230",
                            "nozzle_temp_min": "190",
                            "remain": -1,
                            "tag_uid": "0000000000000000",
                            "tray_color": "7C4B00FF",
                            "tray_diameter": "0.00",
                            "tray_id_name": "",
                            "tray_info_idx": "GFL00",
                            "tray_sub_brands": "",
                            "tray_type": "PLA",
                            "tray_uuid": "00000000000000000000000000000000",
                            "tray_weight": "0",
                            "xcam_info": "000000000000000000000000"
                            "bed_temp": "40",
                            "bed_temp_type": "1",
                            "drying_temp": "80",
                            "drying_time": "8",
                            "id": "2",
                            "nozzle_temp_max": "220",
                            "nozzle_temp_min": "220",
                            "remain": 8,
                            "tag_uid": "D53E550500000100",
                            "tray_color": "FFFFFFFF",
                            "tray_diameter": "1.75",
                            "tray_id_name": "S00-W0",
                            "tray_info_idx": "GFS00",
                            "tray_sub_brands": "Support W",
                            "tray_type": "Support",
                            "tray_uuid": "C802F69ED5824CAFA04D0C13C8F285AA",
                            "tray_weight": "250",
                            "xcam_info": "100E100EE803E8030000803F"
                            "bed_temp": "0",
                            "bed_temp_type": "0",
                            "drying_temp": "0",
                            "drying_time": "0",
                            "id": "3",
                            "nozzle_temp_max": "260",
                            "nozzle_temp_min": "220",
                            "remain": -1,
                            "tag_uid": "0000000000000000",
                            "tray_color": "443089FF",
                            "tray_diameter": "0.00",
                            "tray_id_name": "",
                            "tray_info_idx": "GFG99",
                            "tray_sub_brands": "",
                            "tray_type": "PETG",
                            "tray_uuid": "00000000000000000000000000000000",
                            "tray_weight": "0",
                            "xcam_info": "000000000000000000000000"
            "ams_exist_bits": "1",
            "insert_flag": true,
            "power_on_flag": true,
            "tray_exist_bits": "f",
            "tray_is_bbl_bits": "f",
            "tray_now": "1",
            "tray_read_done_bits": "f",
            "tray_reading_bits": "0",
            "tray_tar": "1",
            "version": 53
        "ams_rfid_status": 2,
        "ams_status": 768,
        "bed_target_temper": 57.0,
        "bed_temper": 57.0,
        "big_fan1_speed": "10",
        "big_fan2_speed": "15",
        "chamber_temper": 39.0,
        "command": "push_status",
        "cooling_fan_speed": "15",
        "fail_reason": "0",
        "fan_gear": 16757503,
        "force_upgrade": false,
        "gcode_file": "/data/Metadata/plate_1.gcode",
        "gcode_file_prepare_percent": "100",
        "gcode_start_time": "1680174906",
        "gcode_state": "RUNNING",
        "heatbreak_fan_speed": "15",
        "hms": [
                "attr": 201327360,
                "code": 131076
        "home_flag": 1463,
        "hw_switch_state": 1,
        "ipcam": {
            "ipcam_dev": "1",
            "ipcam_record": "enable",
            "resolution": "1080p",
            "timelapse": "enable"
        "layer_num": 285,
        "lifecycle": "product",
        "lights_report": [
                "mode": "on",
                "node": "chamber_light"
                "mode": "flashing",
                "node": "work_light"
        "maintain": 3,
        "mc_percent": 82,
        "mc_print_error_code": "0",
        "mc_print_stage": "2",
        "mc_print_sub_stage": 0,
        "mc_remaining_time": 38,
        "mess_production_state": "active",
        "nozzle_target_temper": 235.0,
        "nozzle_temper": 235.0,
        "online": {
            "ahb": false,
            "rfid": false
        "print_error": 0,
        "print_gcode_action": 0,
        "print_real_action": 0,
        "print_type": "cloud",
        "profile_id": "4097567",
        "project_id": "4097867",
        "sdcard": true,
        "sequence_id": "2021",
        "spd_lvl": 2,
        "spd_mag": 100,
        "stg": [
        "stg_cur": 0,
        "subtask_id": "7822827",
        "subtask_name": "Untitled_plate_1",
        "task_id": "7822826",
        "total_layer_num": 401,
        "upgrade_state": {
            "ahb_new_version_number": "",
            "ams_new_version_number": "",
            "consistency_request": false,
            "dis_state": 0,
            "err_code": 0,
            "force_upgrade": false,
            "message": "",
            "module": "null",
            "new_version_state": 2,
            "ota_new_version_number": "",
            "progress": "0",
            "sequence_id": 0,
            "status": "IDLE"
        "upload": {
            "file_size": 0,
            "finish_size": 0,
            "message": "Good",
            "oss_url": "",
            "progress": 0,
            "sequence_id": "0903",
            "speed": 0,
            "status": "idle",
            "task_id": "",
            "time_remaining": 0,
            "trouble_id": ""
        "wifi_signal": "-44dBm",
        "xcam": {
            "allow_skip_parts": false,
            "buildplate_marker_detector": true,
            "first_layer_inspector": true,
            "halt_print_sensitivity": "medium",
            "print_halt": true,
            "printing_monitor": true,
            "spaghetti_detector": true
        "xcam_status": "0"

Hopefully i can go on with the expansion soon :slight_smile:
Or maybe some of you join :wink:

i just found out that its more complex than expected. The item bambuX1C_Status for example can include the state “Running” but it frequently switches to a structure with multiple values. I guess thats the reason why the homeassistant guys set node red inbetween to handle these special things.

I have no idea about node red but i will try to figure out how to use their work for openhab.

1 Like

Heres a bigger update.

I followed this guide to setup the homeassistant guide for integration with node red. (preparation of json, import, change of few nodes)

I just renamed some parts from “homeassistant” to “openhab” else the first part of each state topic has to be renamed.

Some of the values are already looking quide good.

So here are the new files:

Thing mqtt:topic:bambuLab "Bambu X1C" (mqtt:broker:OWN_BROKER_HERE) {
    Type string : state "Status" [stateTopic="openhab/sensor/X1C_Bambu_X1C/print_status/state"]
    Type string : wifi "Empfang" [stateTopic="openhab/sensor/X1C_Bambu_X1C/wifi_signal/state"]
    //Type string : reset_filter "Reset Filter" [stateTopic="openhab/button/X1C_Bambu_X1C/reset_filter/state"]
    Type switch : chamber_light "Licht" [stateTopic="openhab/light/X1C_Bambu_X1C/chamber_light/state"]
    //Type string : ams_count "Anzahl AMS" [stateTopic="openhab/sensor/X1C_Bambu_X1C/ams_count/state"]
    Type number : aux_part_fan "aux_part_fan" [stateTopic="openhab/sensor/X1C_Bambu_X1C/aux_part_fan/state"]
    Type number : bed_temperature "Bett Temperatur" [stateTopic="openhab/sensor/X1C_Bambu_X1C/bed_temperature/state"]
    //Type string : big_fan1 "big_fan1" [stateTopic="openhab/sensor/X1C_Bambu_X1C/big_fan1/state"]
    //Type string : big_fan2 "big_fan2" [stateTopic="openhab/sensor/X1C_Bambu_X1C/big_fan2/state"]
    Type number : chamber_temperature "Kammer Temperatur" [stateTopic="openhab/sensor/X1C_Bambu_X1C/chamber_temperature/state"]
    Type number : cooling_fan "cooling_fan" [stateTopic="openhab/sensor/X1C_Bambu_X1C/cooling_fan/state"]
    Type string : fail_reason "Fehler Ursache" [stateTopic="openhab/sensor/X1C_Bambu_X1C/fail_reason/state"]
    //Type string : fan_gear "fan_gear" [stateTopic="openhab/sensor/X1C_Bambu_X1C/fan_gear/state"]
    Type string : filam_bak "filam_bak" [stateTopic="openhab/sensor/X1C_Bambu_X1C/filam_bak/state"]
    Type string : gcode "gcode" [stateTopic="openhab/sensor/X1C_Bambu_X1C/gcode/state"]
    Type number : heatbreak_fan "heatbreak_fan" [stateTopic="openhab/sensor/X1C_Bambu_X1C/heatbreak_fan/state"]
    //Type string : ipcam "ipcam" [stateTopic="openhab/sensor/X1C_Bambu_X1C/ipcam/state"]
    //Type string : layer_num "Layer" [stateTopic="openhab/sensor/X1C_Bambu_X1C/layer_num/state"]
    //Type string : machine_name "Drucker Name" [stateTopic="openhab/sensor/X1C_Bambu_X1C/machine_name/state"]
    //Type string : machine_serial "Seriennummer" [stateTopic="openhab/sensor/X1C_Bambu_X1C/machine_serial/state"]
    Type string : maintain "maintain" [stateTopic="openhab/sensor/X1C_Bambu_X1C/maintain/state"]
    Type string : mess_production_state "mess_production_state" [stateTopic="openhab/sensor/X1C_Bambu_X1C/mess_production_state/state"]
    //Type string : model "model" [stateTopic="openhab/sensor/X1C_Bambu_X1C/model/state"]
    //Type string : nozzle_diameter "Nozzle Größe" [stateTopic="openhab/sensor/X1C_Bambu_X1C/nozzle_diameter/state"]
    Type number : nozzle_temperature "Nozzle Temperatur" [stateTopic="openhab/sensor/X1C_Bambu_X1C/nozzle_temperature/state"]
    Type string : print "print" [stateTopic="openhab/sensor/X1C_Bambu_X1C/print/state"]
    Type string : print_end_time "Ende" [stateTopic="openhab/sensor/X1C_Bambu_X1C/print_end_time/state"]
    Type string : print_progress "Fortschritt" [stateTopic="openhab/sensor/X1C_Bambu_X1C/print_progress/state"]
    Type string : print_remaining_time "Dauer" [stateTopic="openhab/sensor/X1C_Bambu_X1C/print_remaining_time/state"]
    //Type string : print_start_epoch "print_start_epoch" [stateTopic="openhab/sensor/X1C_Bambu_X1C/print_start_epoch/state"]
    //Type string : print_start_time "Startzeit" [stateTopic="openhab/sensor/X1C_Bambu_X1C/print_start_time/state"]
    //Type string : queue_number "queue_number" [stateTopic="openhab/sensor/X1C_Bambu_X1C/queue_number/state"]
    //Type string : sdcard "sdcard" [stateTopic="openhab/sensor/X1C_Bambu_X1C/sdcard/state"]
    Type string : speed "Geschwindigkeit" [stateTopic="openhab/sensor/X1C_Bambu_X1C/speed/state"]
    Type string : stage "stage" [stateTopic="openhab/sensor/X1C_Bambu_X1C/stage/state"]
    Type string : status "Status" [stateTopic="openhab/sensor/X1C_Bambu_X1C/status/state"]
    Type string : subtask "subtask" [stateTopic="openhab/sensor/X1C_Bambu_X1C/subtask/state"]
    Type string : task_id "task_id" [stateTopic="openhab/sensor/X1C_Bambu_X1C/task_id/state"]
    //Type string : total_layer_num "total_layer_num" [stateTopic="openhab/sensor/X1C_Bambu_X1C/total_layer_num/state"]
    Type string : upgrade_state "upgrade_state" [stateTopic="openhab/sensor/X1C_Bambu_X1C/upgrade_state/state"]
    //Type string : upload "Upload" [stateTopic="openhab/sensor/X1C_Bambu_X1C/upload/state"]
    Type string : vt_tray "vt_tray" [stateTopic="openhab/sensor/X1C_Bambu_X1C/vt_tray/state"]
    Type string : work_light "work_light" [stateTopic="openhab/sensor/X1C_Bambu_X1C/work_light/state"]
    //Type string : xcam "xcam" [stateTopic="openhab/sensor/X1C_Bambu_X1C/xcam/state"]

Thing mqtt:topic:ams0 "Bambu AMS" (mqtt:broker:Zigbee2Mqtt) {
    Type string : ams "AMS" [stateTopic="openhab/sensor/AMS_0_Bambu_X1C/AMS/state"]
    Type number : humidity "humidity" [stateTopic="openhab/sensor/AMS_0_Bambu_X1C/humidity/state"]
    Type string : humidity_level "humidity_level" [stateTopic="openhab/sensor/AMS_0_Bambu_X1C/humidity_level/state"]
    Type string : id "id" [stateTopic="openhab/sensor/AMS_0_Bambu_X1C/id/state"]
    Type string : printer_name "printer_name" [stateTopic="openhab/sensor/AMS_0_Bambu_X1C/printer_name/state"]
    Type string : printer_serial "printer_serial" [stateTopic="openhab/sensor/AMS_0_Bambu_X1C/printer_serial/state"]
    Type number : temp "temp" [stateTopic="openhab/sensor/AMS_0_Bambu_X1C/temp/state"]
    Type string : tray_0_material "tray_0 Material" [stateTopic="openhab/sensor/AMS_0_Bambu_X1C/tray_0/state"]
    Type string : tray_1_material "tray_1 Material" [stateTopic="openhab/sensor/AMS_0_Bambu_X1C/tray_1/state"]
    Type string : tray_2_material "tray_2 Material" [stateTopic="openhab/sensor/AMS_0_Bambu_X1C/tray_2/state"]
    Type string : tray_3_material "tray_3 Material" [stateTopic="openhab/sensor/AMS_0_Bambu_X1C/tray_3/state"] 
    Type string : tray_0_color "tray_0 Material" [stateTopic="openhab/sensor/AMS_0_Bambu_X1C/tray_0/attr", transformationPattern="JSONPATH:$.color", ValueTransformation="REGEX:(.{7}).*"]
    Type string : tray_1_color "tray_1 Material" [stateTopic="openhab/sensor/AMS_0_Bambu_X1C/tray_1/attr", transformationPattern="JSONPATH:$.color"]
    Type string : tray_2_color "tray_2 Material" [stateTopic="openhab/sensor/AMS_0_Bambu_X1C/tray_2/attr", transformationPattern="JSONPATH:$.color"]
    Type string : tray_3_color "tray_3 Material" [stateTopic="openhab/sensor/AMS_0_Bambu_X1C/tray_3/attr", transformationPattern="JSONPATH:$.color"] 


Switch WaitPrinterCoolAndIdle "Drucker Aussschaltverzögerung"
//bambu x1c 
Group                   gX1C
String                  X1C_State                       "Zustand"                                                      (gX1C)        {channel="mqtt:topic:bambuLab:state"}
String                  X1C_Wifi                        "Empfang"                                                      (gX1C)        {channel="mqtt:topic:bambuLab:wifi"}
//String                  X1C_reset_filter                "Reset Filter"                                                 (gX1C)        {channel="mqtt:topic:bambuLab:reset_filter"}
Switch                  X1C_chamber_light               "Licht"                                                (gX1C)        {channel="mqtt:topic:bambuLab:chamber_light"}
//String                  X1C_ams_count                   "Anzahl AMS"                                                    (gX1C)        {channel="mqtt:topic:bambuLab:ams_count"}
Number                  X1C_aux_part_fan                "aux_part_fan"                                                 (gX1C)        {channel="mqtt:topic:bambuLab:aux_part_fan"}
Number                  X1C_bed_temperature             "Bett Temperatur [%.1f °C]"                                              (gX1C)        {channel="mqtt:topic:bambuLab:bed_temperature"}
//String                  X1C_big_fan1                    "big_fan1"                                                     (gX1C)        {channel="mqtt:topic:bambuLab:big_fan1"}
//String                  X1C_big_fan2                    "big_fan2"                                                     (gX1C)        {channel="mqtt:topic:bambuLab:big_fan2"}
Number                  X1C_chamber_temperature         "Kammer Temperatur [%.1f °C]"                                          (gX1C)        {channel="mqtt:topic:bambuLab:chamber_temperature"}
Number                  X1C_cooling_fan                 "cooling_fan"                                                  (gX1C)        {channel="mqtt:topic:bambuLab:cooling_fan"}
String                  X1C_fail_reason                 "Fehler Ursache"                                                  (gX1C)        {channel="mqtt:topic:bambuLab:fail_reason"}
//String                  X1C_fan_gear                    "fan_gear"                                                     (gX1C)        {channel="mqtt:topic:bambuLab:fan_gear"}
String                  X1C_filam_bak                   "filam_bak"                                                    (gX1C)        {channel="mqtt:topic:bambuLab:filam_bak"}
String                  X1C_gcode                       "gcode"                                                        (gX1C)        {channel="mqtt:topic:bambuLab:gcode"}
String                  X1C_heatbreak_fan               "heatbreak_fan"                                                (gX1C)        {channel="mqtt:topic:bambuLab:heatbreak_fan"}
String                  X1C_ipcam                       "ipcam"                                                        (gX1C)        {channel="mqtt:topic:bambuLab:ipcam"}
String                  X1C_layer_num                   "Layer"                                                    (gX1C)        {channel="mqtt:topic:bambuLab:layer_num"}
String                  X1C_machine_name                "machine_name"                                                 (gX1C)        {channel="mqtt:topic:bambuLab:machine_name"}
//String                  X1C_machine_serial              "machine_serial"                                               (gX1C)        {channel="mqtt:topic:bambuLab:machine_serial"}
String                  X1C_maintain                    "maintain"                                                     (gX1C)        {channel="mqtt:topic:bambuLab:maintain"}
String                  X1C_mess_production_state       "mess_production_state"                                        (gX1C)        {channel="mqtt:topic:bambuLab:mess_production_state"}
//String                  X1C_model                       "model"                                                        (gX1C)        {channel="mqtt:topic:bambuLab:model"}
//String                  X1C_nozzle_diameter             "nozzle_diameter"                                              (gX1C)        {channel="mqtt:topic:bambuLab:nozzle_diameter"}
Number                  X1C_nozzle_temperature          "nozzle_temperature [%.1f °C]"                                           (gX1C)        {channel="mqtt:topic:bambuLab:nozzle_temperature"}
String                  X1C_print                       "print"                                                        (gX1C)        {channel="mqtt:topic:bambuLab:print"}
String                  X1C_print_end_time              "Druck Ende"                                               (gX1C)        {channel="mqtt:topic:bambuLab:print_end_time"}
Number                  X1C_print_progress              "Fortschritt [%s] %"                                               (gX1C)        {channel="mqtt:topic:bambuLab:print_progress"}
String                  X1C_print_remaining_time        "Druck Dauer"                                         (gX1C)        {channel="mqtt:topic:bambuLab:print_remaining_time"}
//String                  X1C_print_start_epoch           "print_start_epoch"                                            (gX1C)        {channel="mqtt:topic:bambuLab:print_start_epoch"}
//String                  X1C_print_start_time            "print_start_time"                                             (gX1C)        {channel="mqtt:topic:bambuLab:print_start_time"}
//String                  X1C_queue_number                "queue_number"                                                 (gX1C)        {channel="mqtt:topic:bambuLab:queue_number"}
//String                  X1C_sdcard                      "sdcard"                                                       (gX1C)        {channel="mqtt:topic:bambuLab:sdcard"}
String                  X1C_speed                       "speed"                                                        (gX1C)        {channel="mqtt:topic:bambuLab:speed"}
String                  X1C_stage                       "stage"                                                        (gX1C)        {channel="mqtt:topic:bambuLab:stage"}
String                  X1C_status                      "Verbindungsstatus"                                                       (gX1C)        {channel="mqtt:topic:bambuLab:status"}
String                  X1C_subtask                     "subtask"                                                      (gX1C)        {channel="mqtt:topic:bambuLab:subtask"}
String                  X1C_task_id                     "task_id"                                                      (gX1C)        {channel="mqtt:topic:bambuLab:task_id"}
//String                  X1C_total_layer_num             "total_layer_num"                                              (gX1C)        {channel="mqtt:topic:bambuLab:total_layer_num"}
String                  X1C_upgrade_state               "upgrade_state"                                                (gX1C)        {channel="mqtt:topic:bambuLab:upgrade_state"}
//String                  X1C_upload                      "upload"                                                       (gX1C)        {channel="mqtt:topic:bambuLab:upload"}
String                  X1C_vt_tray                     "vt_tray"                                                      (gX1C)        {channel="mqtt:topic:bambuLab:vt_tray"}
Switch                  X1C_work_light                  "work_light"                                                   (gX1C)        {channel="mqtt:topic:bambuLab:work_light"}
//String                  X1C_xcam                        "xcam"                                                         (gX1C)        {channel="mqtt:topic:bambuLab:xcam"}

//bambu ams
Group                   gAMS0
String                  AMS0_ams                        "ams"                                                          (gAMS0)       {channel="mqtt:topic:ams0:ams"}
Number                  AMS0_humidity                   "humidity [%d %%]"                                                (gAMS0)       {channel="mqtt:topic:ams0:humidity"}
String                  AMS0_humidity_level             "humidity_level"                                               (gAMS0)       {channel="mqtt:topic:ams0:humidity_level"}
String                  AMS0_id                         "id"                                                           (gAMS0)       {channel="mqtt:topic:ams0:id"}
String                  AMS0_printer_name               "printer_name"                                                 (gAMS0)       {channel="mqtt:topic:ams0:printer_name"}
String                  AMS0_printer_serial             "printer_serial"                                               (gAMS0)       {channel="mqtt:topic:ams0:printer_serial"}
Number                  AMS0_temp                       "temp [%.1f °C]"                                                    (gAMS0)       {channel="mqtt:topic:ams0:temp"}
String                  AMS0_tray_0_Material                     "tray_0 Material"                                                       (gAMS0)       {channel="mqtt:topic:ams0:tray_0_material"}
String                  AMS0_tray_1_Material                     "tray_1 Material"                                                       (gAMS0)       {channel="mqtt:topic:ams0:tray_1_material"}
String                  AMS0_tray_2_Material                     "tray_2 Material"                                                       (gAMS0)       {channel="mqtt:topic:ams0:tray_2_material"}
String                  AMS0_tray_3_Material                     "tray_3 Material"                                                       (gAMS0)       {channel="mqtt:topic:ams0:tray_3_material"}
String                  AMS0_tray_0_Color                     "tray_0 Farbe"                                                       (gAMS0)       {channel="mqtt:topic:ams0:tray_0_color"}
String                  AMS0_tray_1_Color                     "tray_1 Farbe"                                                       (gAMS0)       {channel="mqtt:topic:ams0:tray_1_color"}
String                  AMS0_tray_2_Color                     "tray_2 Farbe"                                                       (gAMS0)       {channel="mqtt:topic:ams0:tray_2_color"}
String                  AMS0_tray_3_Color                     "tray_3 Farbe"                                                       (gAMS0)       {channel="mqtt:topic:ams0:tray_3_color"}

Switch X1C_cooledDown "Drucker abgekühlt"  (gX1C) 
Switch X1C_printFinished "Druck abgeschlossen"  (gX1C) 

This is fantastic work, thank you! I just got a Bambu X1Carbon (best 3D printer I’ve ever used) but am missing my Octoprint integration, so my home automation system can’t, say, shut down the printer after a job is done in the middle of the night, or just tell me when the job’s done.

Are there any new developments?

Following with keen interest,


Yes indeed I made some further configuration for e.g. turning the light on and off. For initial setup I made all items as string.

Also I made rules which will send an Openhab notification at print finished and also will shut down the printer by switching a power plug after the printer temperatures are below a Limit.

I will post it as soon as I’m on my computer.

I updated the items and things. Some are comment out because i dont know what to do with them yet. I also added item switches for printer finished and printer cooled down.

Heres is how i realized the autmatic power off function. The item EnablePrinterPowerMan controls the visibility of the printers power switch to prevent someone press it while printer is printing or not cooled down.

var Number temperatureLimit = 40

rule "01 - set temperature cooled down"
    Item X1C_nozzle_temperature changed or
    Item X1C_bed_temperature changed or
    Item X1C_State changed to "IDLE"
    if (X1C_nozzle_temperature.state <= temperatureLimit
        && X1C_bed_temperature.state <= temperatureLimit) {
            if (X1C_cooledDown.state != ON) {
                if (X1C_State.state == "IDLE") {
                    if (EnablePrinterPowerMan != ON) EnablePrinterPowerMan.sendCommand(ON)
    else {
        if (X1C_cooledDown.state != OFF) X1C_cooledDown.sendCommand(OFF)
        if (EnablePrinterPowerMan.state != OFF) EnablePrinterPowerMan.sendCommand(OFF)

rule "02 - set print finished"
    Item X1C_print_progress changed to 100 or
    Item X1C_print_progress changed to 0
    if (X1C_print_progress.state == 100) {
        sendNotification(Email.state.toString,"Druck ist fertig")
    else X1C_printFinished.sendCommand(OFF)

rule "03 - turn off printer"
    Item X1C_printFinished changed to ON or
    Item X1C_cooledDown changed to ON
    if (X1C_printFinished.state == ON){
        if (X1C_cooledDown.state == ON) {
            //DEBUG: sendNotification(Email.state.toString,"Drucker wird ausgeschalten. Temp Nozzle:" + X1C_nozzle_temperature.state.toString)
            if (PowerSwitchPrinter != OFF) PowerSwitchPrinter.sendCommand(OFF)
            if (EnablePrinterPowerMan != ON) EnablePrinterPowerMan.sendCommand(ON)

rule "04 - printer error message"
    Item X1C_fail_reason changed from 0
    sendNotification(Email.state.toString,"Drucker Fehlercode " + X1C_fail_reason.state.toString)


  • decode hex color code to color name would be nice but don’t know how to do it (just a nice to have)
  • decode error codes, but looks like Bambu wiki uses hex codes, the item gives decimal numbers (another nice to have)
  • decode action id. Already done in home assistant link below
  • set bed temp. Therefore the gcode item has to be used. would be useful to have a rule which send a alarm if chamber is preheated for materials like abs

In the home assistant forum they do a lot of fancy stuff: