greghesp / ha-bambulab

A Home Assistant Integration for Bambu Lab Printers
1k stars 85 forks source link

[Bug] Print error binary sensor on X1C, stays always on after last update #641

Closed Chreece closed 2 weeks ago

Chreece commented 2 weeks ago

Describe the bug

Since the v2.0.25 version update. I don't have any errors showing on my display, the AMS errors are also clean. The binary sensor stays always on even after powering off/on the printer. Is it a coincidence?

FW: X1Plus 2.0

To Reproduce

Update to 2.0.25

Expected Behaviour

Since there are no errors on the printer should stay off

What device are you using?

X1C

Diagnostic Output

"integration_manifest": {
    "domain": "bambu_lab",
    "name": "Bambu Lab",
    "codeowners": [
      "greghesp",
      "AdrianGarside"
    ],
    "config_flow": true,
    "dependencies": [
      "device_automation",
      "ffmpeg",
      "mqtt"
    ],
    "documentation": "https://github.com/greghesp/ha-bambulab",
    "iot_class": "local_push",
    "issue_tracker": "https://github.com/greghesp/ha-bambulab/issues",
    "requirements": [
      "httpx>=0.27.0"
    ],
    "ssdp": [
      {
        "st": "urn:bambulab-com:device:3dprinter:1"
      }
    ],
    "version": "2.0.25",
    "is_built_in": false
  },
  "setup_times": {
    "null": {
      "setup": 9.140989277511835e-06
    },
    "01JAR744HTCR6P8QVMGM80NRDB": {
      "wait_import_platforms": -0.05814373899193015,
      "wait_base_component": -0.0005689989920938388,
      "config_entry_setup": 0.07081083100638352
    }
  },
  "data": {
    "config_entry": {
      "created_at": "2024-10-21T18:58:38.778651+00:00",
      "data": {
        "device_type": "X1C",
        "serial": "**REDACTED**"
      },
      "discovery_keys": {},
      "disabled_by": null,
      "domain": "bambu_lab",
      "entry_id": "01JAR744HTCR6P8QVMGM80NRDB",
      "minor_version": 1,
      "modified_at": "2024-10-27T11:24:36.340897+00:00",
      "options": {
        "region": "",
        "email": "",
        "username": "",
        "name": "",
        "host": "192.168.178.101",
        "local_mqtt": true,
        "auth_token": "",
        "access_code": "**REDACTED**",
        "usage_hours": 302.76
      },
      "pref_disable_new_entities": false,
      "pref_disable_polling": false,
      "source": "user",
      "title": "**REDACTED**",
      "unique_id": null,
      "version": 2
    },
    "push_all": {
      "ams": {
        "ams": [
          {
            "humidity": "5",
            "id": "0",
            "temp": "26.2",
            "tray": [
              {
                "bed_temp": "35",
                "bed_temp_type": "1",
                "cali_idx": -1,
                "cols": [
                  "00AE42FF"
                ],
                "ctype": 0,
                "drying_temp": "55",
                "drying_time": "8",
                "id": "0",
                "nozzle_temp_max": "230",
                "nozzle_temp_min": "190",
                "remain": 21,
                "tag_uid": "12B14F7400000100",
                "tray_color": "00AE42FF",
                "tray_diameter": "1.75",
                "tray_id_name": "A00-G1",
                "tray_info_idx": "GFA00",
                "tray_sub_brands": "PLA Basic",
                "tray_type": "PLA",
                "tray_uuid": "C6E66A490B454B1194DBB376B98AF684",
                "tray_weight": "250",
                "xcam_info": "88138813E803E8039A99193F"
              },
              {
                "bed_temp": "0",
                "bed_temp_type": "0",
                "cali_idx": -1,
                "cols": [
                  "161616FF"
                ],
                "ctype": 0,
                "drying_temp": "0",
                "drying_time": "0",
                "id": "1",
                "nozzle_temp_max": "240",
                "nozzle_temp_min": "190",
                "remain": -1,
                "tag_uid": "0000000000000000",
                "tray_color": "161616FF",
                "tray_diameter": "0.00",
                "tray_id_name": "",
                "tray_info_idx": "GFL03",
                "tray_sub_brands": "",
                "tray_type": "PLA",
                "tray_uuid": "00000000000000000000000000000000",
                "tray_weight": "0",
                "xcam_info": "000000000000000000000000"
              },
              {
                "bed_temp": "0",
                "bed_temp_type": "0",
                "cali_idx": -1,
                "cols": [
                  "F72323FF"
                ],
                "ctype": 0,
                "drying_temp": "0",
                "drying_time": "0",
                "id": "2",
                "nozzle_temp_max": "240",
                "nozzle_temp_min": "190",
                "remain": -1,
                "tag_uid": "0000000000000000",
                "tray_color": "F72323FF",
                "tray_diameter": "0.00",
                "tray_id_name": "",
                "tray_info_idx": "GFL03",
                "tray_sub_brands": "",
                "tray_type": "PLA",
                "tray_uuid": "00000000000000000000000000000000",
                "tray_weight": "0",
                "xcam_info": "000000000000000000000000"
              },
              {
                "bed_temp": "0",
                "bed_temp_type": "0",
                "cali_idx": -1,
                "cols": [
                  "057748FF"
                ],
                "ctype": 0,
                "drying_temp": "0",
                "drying_time": "0",
                "id": "3",
                "nozzle_temp_max": "240",
                "nozzle_temp_min": "190",
                "remain": -1,
                "tag_uid": "0000000000000000",
                "tray_color": "057748FF",
                "tray_diameter": "0.00",
                "tray_id_name": "",
                "tray_info_idx": "GFL03",
                "tray_sub_brands": "",
                "tray_type": "PLA",
                "tray_uuid": "00000000000000000000000000000000",
                "tray_weight": "0",
                "xcam_info": "000000000000000000000000"
              }
            ]
          }
        ],
        "ams_exist_bits": "1",
        "ams_exist_bits_raw": "1",
        "insert_flag": true,
        "power_on_flag": false,
        "tray_exist_bits": "f",
        "tray_is_bbl_bits": "f",
        "tray_now": "255",
        "tray_pre": "255",
        "tray_read_done_bits": "f",
        "tray_reading_bits": "0",
        "tray_tar": "255",
        "version": 30
      },
      "ams_rfid_status": 0,
      "ams_status": 0,
      "aux_part_fan": true,
      "bed_target_temper": 0.0,
      "bed_temper": 28.0,
      "big_fan1_speed": "0",
      "big_fan2_speed": "0",
      "cali_version": 0,
      "chamber_temper": 28.0,
      "command": "push_status",
      "cooling_fan_speed": "0",
      "ctt": 0,
      "device": {
        "fan": 0,
        "nozzle": {
          "0": {
            "info": 8,
            "temp": 32
          },
          "info": 9
        }
      },
      "fail_reason": "0",
      "fan_gear": 0,
      "filam_bak": [],
      "force_upgrade": false,
      "gcode_file": "/data/Metadata/plate_1.gcode",
      "gcode_file_prepare_percent": "100",
      "gcode_state": "FINISH",
      "heatbreak_fan_speed": "0",
      "hms": [],
      "home_flag": 6407583,
      "hw_switch_state": 0,
      "ipcam": {
        "agora_service": "disable",
        "ipcam_dev": "1",
        "ipcam_record": "disable",
        "mode_bits": 2,
        "resolution": "720p",
        "rtsp_url": "**REDACTED**",
        "timelapse": "disable",
        "tutk_server": "disable"
      },
      "job_id": "0",
      "layer_num": 99,
      "lights_report": [
        {
          "mode": "off",
          "node": "chamber_light"
        },
        {
          "mode": "flashing",
          "node": "work_light"
        }
      ],
      "maintain": 3,
      "mc_percent": 100,
      "mc_print_error_code": "0",
      "mc_print_stage": "1",
      "mc_print_sub_stage": 0,
      "mc_remaining_time": 0,
      "net": {
        "conf": 16,
        "info": [
          {
            "ip": 1706207424,
            "mask": 16777215
          },
          {
            "ip": 0,
            "mask": 0
          }
        ]
      },
      "nozzle_diameter": "0.4",
      "nozzle_target_temper": 0.0,
      "nozzle_temper": 32.0,
      "nozzle_type": "hardened_steel",
      "online": {
        "ahb": false,
        "ext": false,
        "version": 4
      },
      "print_error": 0,
      "print_gcode_action": 255,
      "print_real_action": 0,
      "print_type": "local",
      "profile_id": "0",
      "project_id": "0",
      "queue_est": 0,
      "queue_number": 0,
      "queue_sts": 0,
      "queue_total": 0,
      "s_obj": [],
      "sdcard": true,
      "sequence_id": "2021",
      "spd_lvl": 2,
      "spd_mag": 100,
      "stg": [
        2,
        14,
        1,
        8
      ],
      "stg_cur": -1,
      "subtask_id": "0",
      "subtask_name": "The_Shifty_-_Build_Plate_Guide",
      "task_id": "730",
      "total_layer_num": 99,
      "upgrade_state": {
        "ahb_new_version_number": "",
        "ams_new_version_number": "",
        "consistency_request": false,
        "dis_state": 1,
        "err_code": 0,
        "ext_new_version_number": "",
        "force_upgrade": false,
        "idx": 4,
        "idx1": 1,
        "message": "",
        "module": "",
        "new_version_state": 2,
        "ota_new_version_number": "01.06.06.58",
        "progress": "0",
        "sequence_id": 0,
        "sn": "**REDACTED**",
        "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": ""
      },
      "vt_tray": {
        "bed_temp": "0",
        "bed_temp_type": "0",
        "cali_idx": -1,
        "cols": [
          "00000000"
        ],
        "ctype": 0,
        "drying_temp": "0",
        "drying_time": "0",
        "id": "254",
        "nozzle_temp_max": "0",
        "nozzle_temp_min": "0",
        "remain": 0,
        "tag_uid": "0000000000000000",
        "tray_color": "00000000",
        "tray_diameter": "0.00",
        "tray_id_name": "",
        "tray_info_idx": "",
        "tray_sub_brands": "",
        "tray_type": "",
        "tray_uuid": "00000000000000000000000000000000",
        "tray_weight": "0",
        "xcam_info": "000000000000000000000000"
      },
      "wifi_signal": "-36dBm",
      "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"
    },
    "get_version": {
      "command": "get_version",
      "module": [
        {
          "flag": 0,
          "hw_ver": "N/A",
          "name": "ota",
          "new_ver": "01.06.06.58",
          "sn": "**REDACTED**",
          "sw_ver": "99.00.00.00"
        },
        {
          "flag": 0,
          "hw_ver": "AMS08",
          "name": "ams/0",
          "sn": "**REDACTED**",
          "sw_ver": "00.00.06.40"
        },
        {
          "flag": 0,
          "hw_ver": "MC07",
          "name": "mc",
          "sn": "**REDACTED**",
          "sw_ver": "00.00.27.26"
        },
        {
          "flag": 0,
          "hw_ver": "SMC01",
          "name": "sm",
          "sn": "**REDACTED**",
          "sw_ver": "00.00.27.26"
        },
        {
          "flag": 0,
          "hw_ver": "TH09",
          "name": "th",
          "sn": "**REDACTED**",
          "sw_ver": "00.00.07.12"
        },
        {
          "flag": 0,
          "hw_ver": "AP05",
          "name": "ap",
          "new_ver": "00.00.30.73",
          "sn": "**REDACTED**",
          "sw_ver": "00.00.32.18"
        }
      ],
      "sequence_id": "0"
    }
  }
}


### Log Extracts

_No response_

### Other Information

_No response_
Chreece commented 2 weeks ago

The 'print_error' key is 0 in the diagnostics

Econut commented 2 weeks ago

Hi

Since the update the printer error for me in home assistant stays as "problem" no matter what i do, i was using this in a automation to control led's over the printers so they turn red on a problem to highlight the printer but now they just turn red all the time. i think this is simular to the problem you have?

Chreece commented 2 weeks ago

Yes there were some changes on the print_error handling but I'm not sure what is the problem

Chreece commented 2 weeks ago

You can make some reverse changes to the custom_components/bambu_lab/pybambu/models.py:

line 1195, change to: self._error = None line 1205, change to: errors = None

I'm not even sure if this is the right approach and why did @AdrianGarside change it to {} but for me it works...

AdrianGarside commented 2 weeks ago

That was just a mistake. I started changing thing to address a bug and then realized that the bug was elsewhere and failed to reverse those changes and they got missed alongside other changes to the file. Fix coming.

AdrianGarside commented 2 weeks ago

Fixed in v2.0.26