ha-bambulab icon indicating copy to clipboard operation
ha-bambulab copied to clipboard

[Bug] 2024-09-25 08:09:19.447 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback BambuDataUpdateCoordinator.event_handler_internal('event_print_error') (None)

Open braveheuel opened this issue 4 months ago • 0 comments

Describe the bug

When the Bambu runs into an error, I get errors thrown at HA:

Sep 25 08:09:19 arthur systemd-homeassistant[2596]: 2024-09-25 08:09:19.447 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback BambuDataUpdateCoordinator.event_handler_internal('event_print_error') (None)
Sep 25 08:09:19 arthur systemd-homeassistant[2596]: Traceback (most recent call last):
Sep 25 08:09:19 arthur systemd-homeassistant[2596]:   File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
Sep 25 08:09:19 arthur systemd-homeassistant[2596]:     self._context.run(self._callback, *self._args)
Sep 25 08:09:19 arthur systemd-homeassistant[2596]:   File "/config/custom_components/bambu_lab/coordinator.py", line 109, in event_handler_internal
Sep 25 08:09:19 arthur systemd-homeassistant[2596]:     self._update_print_error()
Sep 25 08:09:19 arthur systemd-homeassistant[2596]:   File "/config/custom_components/bambu_lab/coordinator.py", line 194, in _update_print_error
Sep 25 08:09:19 arthur systemd-homeassistant[2596]:     if 'Code' in device.print_error.errors:
Sep 25 08:09:19 arthur systemd-homeassistant[2596]:                  ^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 25 08:09:19 arthur systemd-homeassistant[2596]: AttributeError: 'PrintErrorList' object has no attribute 'errors'. Did you mean: 'error'?

To Reproduce

  1. In this case the Bambu Printer had tangled filament
  2. See in the logs of HA (Bug description)

Expected Behaviour

No AttributeError shown

What device are you using?

X1C

Diagnostic Output

{
  "home_assistant": {
    "installation_type": "Unknown",
    "version": "2024.9.0",
    "dev": false,
    "hassio": false,
    "virtualenv": false,
    "python_version": "3.12.4",
    "docker": false,
    "arch": "x86_64",
    "timezone": "Europe/Berlin",
    "os_name": "Linux",
    "os_version": "6.1.0-25-amd64",
    "run_as_root": true
  },
  "custom_components": {
    "bambu_lab": {
      "documentation": "https://github.com/greghesp/ha-bambulab",
      "version": "2.0.22",
      "requirements": []
    }
  },
  "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",
    "ssdp": [
      {
        "st": "urn:bambulab-com:device:3dprinter:1"
      }
    ],
    "version": "2.0.22",
    "is_built_in": false
  },
  "setup_times": {
    "null": {
      "setup": 1.780991442501545e-05
    },
    "9687dbdf1f021acae225da4440065d8f": {
      "wait_import_platforms": -0.03299302491359413,
      "config_entry_setup": 0.05213162209838629,
      "config_entry_platform_setup": 0.013296987162902951
    }
  },
  "data": {
    "config_entry": {
      "created_at": "1970-01-01T00:00:00+00:00",
      "data": {
        "device_type": "X1C",
        "serial": "**REDACTED**"
      },
      "disabled_by": null,
      "domain": "bambu_lab",
      "entry_id": "9687dbdf1f021acae225da4440065d8f",
      "minor_version": 1,
      "modified_at": "2024-09-25T22:20:19.311180+00:00",
      "options": {
        "region": "",
        "email": "",
        "username": "",
        "name": "X1C",
        "host": "bambulabxc1.deepspace",
        "local_mqtt": true,
        "auth_token": "",
        "access_code": "**REDACTED**",
        "usage_hours": 87.56999999999998
      },
      "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": "41.4",
            "tray": [
              {
                "bed_temp": "35",
                "bed_temp_type": "1",
                "cali_idx": -1,
                "cols": [
                  "6E88BCFF"
                ],
                "ctype": 0,
                "drying_temp": "55",
                "drying_time": "8",
                "id": "0",
                "nozzle_temp_max": "240",
                "nozzle_temp_min": "200",
                "remain": 50,
                "tag_uid": "8078965E00000100",
                "tray_color": "6E88BCFF",
                "tray_diameter": "1.75",
                "tray_id_name": "A50-B9",
                "tray_info_idx": "GFA50",
                "tray_sub_brands": "PLA-CF",
                "tray_type": "PLA-CF",
                "tray_uuid": "AB6CE6D86F3C4DF2B9974F7AC88C80F2",
                "tray_weight": "1000",
                "xcam_info": "D007D0078403E8036666663F"
              },
              {
                "bed_temp": "35",
                "bed_temp_type": "1",
                "cali_idx": -1,
                "cols": [
                  "000000FF"
                ],
                "ctype": 0,
                "drying_temp": "55",
                "drying_time": "8",
                "id": "1",
                "nozzle_temp_max": "230",
                "nozzle_temp_min": "190",
                "remain": 78,
                "tag_uid": "D23E797500000100",
                "tray_color": "000000FF",
                "tray_diameter": "1.75",
                "tray_id_name": "A00-K0",
                "tray_info_idx": "GFA00",
                "tray_sub_brands": "PLA Basic",
                "tray_type": "PLA",
                "tray_uuid": "DDB0A990BCE0412EACD9724969024689",
                "tray_weight": "1000",
                "xcam_info": "803E803EE803E803CDCC4C3F"
              },
              {
                "bed_temp": "0",
                "bed_temp_type": "0",
                "cali_idx": -1,
                "cols": [
                  "FFFFFFFF"
                ],
                "ctype": 0,
                "drying_temp": "0",
                "drying_time": "0",
                "id": "2",
                "nozzle_temp_max": "270",
                "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",
                "cali_idx": -1,
                "cols": [
                  "000000FF"
                ],
                "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": "000000FF",
                "tray_diameter": "0.00",
                "tray_id_name": "",
                "tray_info_idx": "GFL99",
                "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": 2600
      },
      "ams_rfid_status": 0,
      "ams_status": 0,
      "aux_part_fan": true,
      "bed_target_temper": 0.0,
      "bed_temper": 58.0,
      "big_fan1_speed": "0",
      "big_fan2_speed": "0",
      "cali_version": 0,
      "chamber_temper": 35.0,
      "command": "push_status",
      "cooling_fan_speed": "0",
      "ctt": 0,
      "device": {
        "fan": 61440,
        "nozzle": {
          "0": {
            "info": 8,
            "temp": 60
          },
          "info": 33
        }
      },
      "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": "15",
      "hms": [],
      "home_flag": 6406543,
      "hw_switch_state": 0,
      "ipcam": {
        "agora_service": "disable",
        "ipcam_dev": "1",
        "ipcam_record": "enable",
        "mode_bits": 2,
        "resolution": "1080p",
        "rtsp_url": "**REDACTED**",
        "timelapse": "disable",
        "tutk_server": "disable"
      },
      "job_id": "0",
      "layer_num": 200,
      "lights_report": [
        {
          "mode": "on",
          "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": 771860672,
            "mask": 16777215
          },
          {
            "ip": 0,
            "mask": 0
          }
        ]
      },
      "nozzle_diameter": "0.4",
      "nozzle_target_temper": 0.0,
      "nozzle_temper": 60.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": "",
      "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": "",
      "subtask_name": "Alles fu00fcr die Filamentbox_plate_1.gcode.3mf",
      "task_id": "3293",
      "total_layer_num": 200,
      "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": 0,
        "message": "",
        "module": "",
        "new_version_state": 2,
        "ota_new_version_number": "",
        "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": [
          "000000FF"
        ],
        "ctype": 0,
        "drying_temp": "0",
        "drying_time": "0",
        "id": "254",
        "nozzle_temp_max": "250",
        "nozzle_temp_min": "200",
        "remain": 0,
        "tag_uid": "0000000000000000",
        "tray_color": "000000FF",
        "tray_diameter": "0.00",
        "tray_id_name": "",
        "tray_info_idx": "GFU99",
        "tray_sub_brands": "",
        "tray_type": "TPU",
        "tray_uuid": "00000000000000000000000000000000",
        "tray_weight": "0",
        "xcam_info": "000000000000000000000000"
      },
      "wifi_signal": "-66dBm",
      "xcam": {
        "allow_skip_parts": false,
        "buildplate_marker_detector": true,
        "first_layer_inspector": true,
        "halt_print_sensitivity": "low",
        "print_halt": true,
        "printing_monitor": true,
        "spaghetti_detector": true
      },
      "xcam_status": "0"
    },
    "get_version": {
      "command": "get_version",
      "module": [
        {
          "flag": 3,
          "hw_ver": "N/A",
          "name": "ota",
          "sn": "**REDACTED**",
          "sw_ver": "01.08.00.00"
        },
        {
          "flag": 0,
          "hw_ver": "AMS08",
          "name": "ams/0",
          "sn": "**REDACTED**",
          "sw_ver": "00.00.06.44"
        },
        {
          "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",
          "sn": "**REDACTED**",
          "sw_ver": "00.00.32.18"
        }
      ],
      "sequence_id": "0"
    }
  }
}

Log Extracts

No response

Other Information

No response

braveheuel avatar Sep 25 '24 22:09 braveheuel