greghesp / ha-bambulab

A Home Assistant Integration for Bambu Lab Printers
851 stars 68 forks source link

[Bug] Cover image not showing in home assistant #377

Open trwy7 opened 9 months ago

trwy7 commented 9 months ago

Describe the bug

When I click on the cover image, I get a "500: Internal Server Error"

To Reproduce

  1. Setup printer with Bambu cloud
  2. Input printer IP address

Expected Behaviour

I expected an preview of what was printing

What device are you using?

A1

Diagnostic Output

Github wont let me upload a file here.

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2023.12.4",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.11.6",
    "docker": true,
    "arch": "aarch64",
    "timezone": "America/Denver",
    "os_name": "Linux",
    "os_version": "6.1.58-haos-raspi",
    "supervisor": "2023.12.0",
    "host_os": "Home Assistant OS 11.2",
    "docker_version": "24.0.7",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "bambu_lab": {
      "version": "2.0.3",
      "requirements": []
    },
    "tesla_custom": {
      "version": "3.19.4",
      "requirements": [
        "teslajsonpy==3.9.8"
      ]
    },
    "hacs": {
      "version": "1.33.0",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "avanza_stock": {
      "version": "1.4.0",
      "requirements": [
        "pyavanza==0.6.0"
      ]
    }
  },
  "integration_manifest": {
    "domain": "bambu_lab",
    "name": "Bambu Lab",
    "codeowners": [
      "@greghesp",
      "@AdrianGarside"
    ],
    "config_flow": true,
    "dependencies": [
      "device_automation",
      "mqtt",
      "ffmpeg"
    ],
    "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.3",
    "is_built_in": false
  },
  "data": {
    "config_entry": {
      "entry_id": "9e9a177268042c4f74190e36c48054cf",
      "version": 2,
      "domain": "bambu_lab",
      "title": "**REDACTED**",
      "data": {
        "device_type": "A1",
        "serial": "**REDACTED**"
      },
      "options": {
        "region": "NorthAmerica",
        "email": "**REDACTED**",
        "username": "**REDACTED**",
        "name": "3DP-039-391",
        "host": "10.0.0.16",
        "local_mqtt": true,
        "auth_token": "**REDACTED**",
        "access_code": "**REDACTED**"
      },
      "pref_disable_new_entities": false,
      "pref_disable_polling": false,
      "source": "user",
      "unique_id": null,
      "disabled_by": null
    },
    "push_all": {
      "upload": {
        "status": "idle",
        "progress": 0,
        "message": ""
      },
      "nozzle_temper": 220.03125,
      "nozzle_target_temper": 220,
      "bed_temper": 65.03125,
      "bed_target_temper": 65,
      "chamber_temper": 5,
      "mc_print_stage": "2",
      "heatbreak_fan_speed": "10",
      "cooling_fan_speed": "14",
      "big_fan1_speed": "14",
      "big_fan2_speed": "14",
      "mc_percent": 39,
      "mc_remaining_time": 97,
      "ams_status": 768,
      "ams_rfid_status": 2,
      "hw_switch_state": 1,
      "spd_mag": 124,
      "spd_lvl": 3,
      "print_error": 0,
      "lifecycle": "product",
      "wifi_signal": "-56dBm",
      "gcode_state": "RUNNING",
      "gcode_file_prepare_percent": "100",
      "queue_number": 0,
      "queue_total": 0,
      "queue_est": 0,
      "queue_sts": 0,
      "project_id": "37974737",
      "profile_id": "37571471",
      "task_id": "73926202",
      "subtask_id": "73926203",
      "subtask_name": "Marble Run 003",
      "gcode_file": "Marble Run 003.3mf",
      "stg": [
        2,
        13,
        24,
        4,
        3,
        14,
        13
      ],
      "stg_cur": 0,
      "print_type": "cloud",
      "home_flag": 3687863,
      "mc_print_line_number": "99689",
      "mc_print_sub_stage": 1,
      "sdcard": true,
      "force_upgrade": false,
      "mess_production_state": "active",
      "layer_num": 381,
      "total_layer_num": 1189,
      "s_obj": [],
      "fan_gear": 255,
      "upgrade_state": {
        "sequence_id": 0,
        "progress": "",
        "status": "",
        "consistency_request": false,
        "dis_state": 0,
        "err_code": 0,
        "force_upgrade": false,
        "message": "0%, 0B/s",
        "module": "",
        "new_version_state": 2,
        "cur_state_code": 1,
        "new_ver_list": []
      },
      "hms": [],
      "online": {
        "ahb": false,
        "rfid": false,
        "version": 924850508
      },
      "ams": {
        "ams": [
          {
            "id": "0",
            "humidity": "5",
            "temp": "0.0",
            "tray": [
              {
                "id": "0",
                "remain": 100,
                "k": 0.019999999552965164,
                "n": 1,
                "tag_uid": "0000000000000000",
                "tray_id_name": "",
                "tray_info_idx": "GFL03",
                "tray_type": "PLA",
                "tray_sub_brands": "",
                "tray_color": "FFFFFFFF",
                "tray_weight": "0",
                "tray_diameter": "0.00",
                "tray_temp": "0",
                "tray_time": "0",
                "bed_temp_type": "0",
                "bed_temp": "0",
                "nozzle_temp_max": "240",
                "nozzle_temp_min": "190",
                "xcam_info": "000000000000000000000000",
                "tray_uuid": "00000000000000000000000000000000"
              },
              {
                "id": "1",
                "remain": 100,
                "k": 0.019999999552965164,
                "n": 1,
                "tag_uid": "0000000000000000",
                "tray_id_name": "",
                "tray_info_idx": "GFL03",
                "tray_type": "PLA",
                "tray_sub_brands": "",
                "tray_color": "DD4646FF",
                "tray_weight": "0",
                "tray_diameter": "0.00",
                "tray_temp": "0",
                "tray_time": "0",
                "bed_temp_type": "0",
                "bed_temp": "0",
                "nozzle_temp_max": "240",
                "nozzle_temp_min": "190",
                "xcam_info": "000000000000000000000000",
                "tray_uuid": "00000000000000000000000000000000"
              },
              {
                "id": "2",
                "remain": 100,
                "k": 0.019999999552965164,
                "n": 1,
                "tag_uid": "0000000000000000",
                "tray_id_name": "",
                "tray_info_idx": "GFL03",
                "tray_type": "PLA",
                "tray_sub_brands": "",
                "tray_color": "0D3ADAFF",
                "tray_weight": "0",
                "tray_diameter": "0.00",
                "tray_temp": "0",
                "tray_time": "0",
                "bed_temp_type": "0",
                "bed_temp": "0",
                "nozzle_temp_max": "240",
                "nozzle_temp_min": "190",
                "xcam_info": "000000000000000000000000",
                "tray_uuid": "00000000000000000000000000000000"
              },
              {
                "id": "3",
                "remain": 100,
                "k": 0.019999999552965164,
                "n": 1,
                "tag_uid": "0000000000000000",
                "tray_id_name": "",
                "tray_info_idx": "GFL03",
                "tray_type": "PLA",
                "tray_sub_brands": "",
                "tray_color": "AFF31EFF",
                "tray_weight": "0",
                "tray_diameter": "0.00",
                "tray_temp": "0",
                "tray_time": "0",
                "bed_temp_type": "0",
                "bed_temp": "0",
                "nozzle_temp_max": "240",
                "nozzle_temp_min": "190",
                "xcam_info": "000000000000000000000000",
                "tray_uuid": "00000000000000000000000000000000"
              }
            ]
          }
        ],
        "ams_exist_bits": "1",
        "tray_exist_bits": "f",
        "tray_is_bbl_bits": "f",
        "tray_tar": "0",
        "tray_now": "0",
        "tray_pre": "0",
        "tray_read_done_bits": "f",
        "tray_reading_bits": "0",
        "version": 15,
        "insert_flag": true,
        "power_on_flag": false
      },
      "ipcam": {
        "ipcam_dev": "1",
        "ipcam_record": "enable",
        "timelapse": "disable",
        "resolution": "1536x1080",
        "mode_bits": 3
      },
      "vt_tray": {
        "id": "254",
        "tag_uid": "0000000000000000",
        "tray_id_name": "",
        "tray_info_idx": "",
        "tray_type": "",
        "tray_sub_brands": "",
        "tray_color": "00000000",
        "tray_weight": "0",
        "tray_diameter": "0.00",
        "tray_temp": "0",
        "tray_time": "0",
        "bed_temp_type": "0",
        "bed_temp": "0",
        "nozzle_temp_max": "0",
        "nozzle_temp_min": "0",
        "xcam_info": "000000000000000000000000",
        "tray_uuid": "00000000000000000000000000000000",
        "remain": 0,
        "k": 0.019999999552965164,
        "n": 1
      },
      "lights_report": [
        {
          "node": "chamber_light",
          "mode": "on"
        }
      ],
      "command": "push_status",
      "msg": 0,
      "sequence_id": "12623"
    },
    "get_version": {
      "command": "get_version",
      "sequence_id": "0",
      "module": [
        {
          "name": "ota",
          "project_name": "N2S",
          "sw_ver": "01.01.01.00",
          "hw_ver": "OTA",
          "sn": "**REDACTED**"
        },
        {
          "name": "esp32",
          "project_name": "N2S",
          "sw_ver": "01.07.22.30",
          "hw_ver": "AP05",
          "sn": "**REDACTED**"
        },
        {
          "name": "mc",
          "project_name": "N2S",
          "sw_ver": "00.00.20.63",
          "loader_ver": "00.00.00.32",
          "hw_ver": "MC02",
          "sn": "**REDACTED**"
        },
        {
          "name": "th",
          "project_name": "N2S",
          "sw_ver": "00.00.06.74",
          "loader_ver": "00.00.00.26",
          "hw_ver": "TH01",
          "sn": "**REDACTED**"
        },
        {
          "name": "ams_f1/0",
          "project_name": "",
          "sw_ver": "00.00.07.89",
          "loader_ver": "00.00.00.00",
          "ota_ver": "00.00.00.00",
          "hw_ver": "AMS_F102",
          "sn": "**REDACTED**"
        }
      ],
      "result": "success",
      "reason": ""
    }
  }
}

Log Extracts

No response

Other Information

Continuation of #368 (https://github.com/greghesp/ha-bambulab/issues/368#issuecomment-1872256399)

trwy7 commented 9 months ago

image Forgot to add my screenshot

AdrianGarside commented 9 months ago

I’m going to need debug logs to have any hope of working out why it’s not working for you. What version of the integration are you running? And what version of home assistant?

trwy7 commented 9 months ago

Version: 2.0.3 Home assistant version: 2023.12.4 Home assistant frontend version: 20231208.2

mehhhhhhhhhhhhhhhhhhhhhhhhhh commented 8 months ago

I’m having the same issue.

Version: 2.0.5 Home Assistant Core 2024.1.1

AdrianGarside commented 8 months ago

Can you provide debug logs of a repro please.

trwy7 commented 8 months ago

Can you provide debug logs of a repro please.

All i get is 2024-01-06 16:04:55.949 DEBUG (Thread-26) [custom_components.bambu_lab.pybambu] JPEG RECEIVED: A1 2024-01-06 16:04:55.950 DEBUG (Thread-26) [custom_components.bambu_lab] Manually updated bambu_lab data 2024-01-06 16:04:55.962 DEBUG (Thread-26) [custom_components.bambu_lab.pybambu] JPEG RECEIVED: A1 2024-01-06 16:04:55.963 DEBUG (Thread-26) [custom_components.bambu_lab] Manually updated bambu_lab data 2024-01-06 16:04:56.973 DEBUG (Thread-26) [custom_components.bambu_lab.pybambu] JPEG RECEIVED: A1 2024-01-06 16:04:56.974 DEBUG (Thread-26) [custom_components.bambu_lab] Manually updated bambu_lab data 2024-01-06 16:04:56.989 DEBUG (Thread-26) [custom_components.bambu_lab.pybambu] JPEG RECEIVED: A1 2024-01-06 16:04:56.989 DEBUG (Thread-26) [custom_components.bambu_lab] Manually updated bambu_lab data 2024-01-06 16:04:57.721 DEBUG (Thread-17 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Received data from: A1 2024-01-06 16:04:57.722 DEBUG (Thread-17 (mqtt_listen_thread)) [custom_components.bambu_lab] Manually updated bambu_lab data. It keeps repeating in my logs, and no other issues show. (except warnings from other integrations)

AdrianGarside commented 8 months ago

The cover image is only downloaded at print start or integration start. There will be logs about looking up the task information.

AdrianGarside commented 8 months ago

Actually your log snippet looks incomplete. The only activity showing is the camera image. You should be seeing lines like this:

2024-01-07 14:42:16.294 DEBUG (Thread-4 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Received data from: P1P Sometimes (but not always) paired with additional 'Manually updated bambu_lab' entries when any of the data changed.

trwy7 commented 8 months ago

Actually your log snippet looks incomplete. The only activity showing is the camera image. You should be seeing lines like this:

2024-01-07 14:42:16.294 DEBUG (Thread-4 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Received data from: P1P Sometimes (but not always) paired with additional 'Manually updated bambu_lab' entries when any of the data changed.

Yep I did not notice that, it happens about every 10 manually updated data lines.

This log is taken straight after an integration restart 2024-01-11 17:23:18.846 DEBUG (Thread-23) [custom_components.bambu_lab] Manually updated bambu_lab data 2024-01-11 17:23:19.399 DEBUG (MainThread) [custom_components.bambu_lab] async_unload_entry 2024-01-11 17:23:19.399 DEBUG (MainThread) [custom_components.bambu_lab] async_unload_entry: (<Platform.BINARY_SENSOR: 'binary_sensor'>, <Platform.BUTTON: 'button'>, <Platform.CAMERA: 'camera'>, <Platform.FAN: 'fan'>, <Platform.IMAGE: 'image'>, <Platform.LIGHT: 'light'>, <Platform.SELECT: 'select'>, <Platform.SENSOR: 'sensor'>, <Platform.SWITCH: 'switch'>) 2024-01-11 17:23:19.436 DEBUG (MainThread) [custom_components.bambu_lab.pybambu] Disconnect: Client Disconnecting 2024-01-11 17:23:19.437 WARNING (MainThread) [custom_components.bambu_lab.pybambu] On Disconnect: Disconnected from Broker: 0 2024-01-11 17:23:19.438 DEBUG (MainThread) [custom_components.bambu_lab] Manually updated bambu_lab data 2024-01-11 17:23:19.440 INFO (Thread-22) [custom_components.bambu_lab.pybambu] Watchdog thread exited. 2024-01-11 17:23:19.858 INFO (Thread-23) [custom_components.bambu_lab.pybambu] A1: Chamber image thread exited. 2024-01-11 17:23:19.860 DEBUG (MainThread) [custom_components.bambu_lab] Async Setup Unload Done 2024-01-11 17:23:19.861 DEBUG (MainThread) [custom_components.bambu_lab] async_setup_entry Start 2024-01-11 17:23:19.862 DEBUG (MainThread) [custom_components.bambu_lab] ConfigEntry.Id: c961f228781819a169d2bbaa499fdc9f 2024-01-11 17:23:19.862 DEBUG (MainThread) [custom_components.bambu_lab] HA POLL: MQTT connected: False 2024-01-11 17:23:19.863 DEBUG (MainThread) [custom_components.bambu_lab] Finished fetching bambu_lab data in 0.000 seconds (success: True) 2024-01-11 17:23:19.866 WARNING (Thread-17 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] On Disconnect: Disconnected from Broker: 0 2024-01-11 17:23:19.870 DEBUG (Thread-17 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Ended listen loop. 2024-01-11 17:23:19.870 INFO (Thread-17 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] MQTT listener thread exited. 2024-01-11 17:23:19.901 DEBUG (MainThread) [custom_components.bambu_lab] BUTTON::async_setup_entry 2024-01-11 17:23:19.901 DEBUG (MainThread) [custom_components.bambu_lab] CAMERA::async_setup_entry 2024-01-11 17:23:19.901 DEBUG (MainThread) [custom_components.bambu_lab] FAN::async_setup_entry 2024-01-11 17:23:19.901 DEBUG (MainThread) [custom_components.bambu_lab] FAN::async_setup_entry DONE 2024-01-11 17:23:19.902 DEBUG (MainThread) [custom_components.bambu_lab] IMAGE::async_setup_entry 2024-01-11 17:23:19.902 DEBUG (MainThread) [custom_components.bambu_lab] SELECT::async_setup_entry 2024-01-11 17:23:19.903 DEBUG (MainThread) [custom_components.bambu_lab] SWITCH::async_setup_entry 2024-01-11 17:23:19.963 DEBUG (MainThread) [custom_components.bambu_lab] async_setup_entry Complete 2024-01-11 17:23:19.963 DEBUG (MainThread) [custom_components.bambu_lab] Starting MQTT 2024-01-11 17:23:20.032 DEBUG (MainThread) [custom_components.bambu_lab.pybambu] Starting MQTT listener thread 2024-01-11 17:23:20.033 INFO (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] MQTT listener thread started. 2024-01-11 17:23:20.033 DEBUG (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Connect: Attempting Connection to 10.0.0.16 2024-01-11 17:23:20.899 DEBUG (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Starting listen loop 2024-01-11 17:23:20.908 INFO (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] On Connect: Connected to Broker 2024-01-11 17:23:20.908 DEBUG (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Now subscribing... 2024-01-11 17:23:20.908 DEBUG (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Subscribing: device/SERIALNUMBER/report 2024-01-11 17:23:20.909 DEBUG (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] On Connect: Getting version info 2024-01-11 17:23:20.909 DEBUG (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Sent {'info': {'sequence_id': '0', 'command': 'get_version'}} to topic device/SERIALNUMBER/request 2024-01-11 17:23:20.910 DEBUG (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] On Connect: Request push all 2024-01-11 17:23:20.910 DEBUG (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Sent {'pushing': {'sequence_id': '0', 'command': 'pushall'}} to topic device/SERIALNUMBER/request 2024-01-11 17:23:20.910 DEBUG (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Starting watchdog thread 2024-01-11 17:23:20.912 INFO (Thread-63) [custom_components.bambu_lab.pybambu] Watchdog thread started. 2024-01-11 17:23:20.913 DEBUG (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Starting Chamber Image thread 2024-01-11 17:23:20.915 DEBUG (Thread-64) [custom_components.bambu_lab.pybambu] {self._client._device.info.device_type}: Chamber image thread started. 2024-01-11 17:23:20.935 DEBUG (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Received data from: A1 2024-01-11 17:23:20.935 DEBUG (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab] Manually updated bambu_lab data 2024-01-11 17:23:20.939 DEBUG (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Got Version Data 2024-01-11 17:23:20.939 DEBUG (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Device is A1 2024-01-11 17:23:20.940 DEBUG (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab] '01.01.01.00' 'AP05' 2024-01-11 17:23:20.940 DEBUG (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Device is A1 2024-01-11 17:23:20.940 DEBUG (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab] Initialize AMS 1 2024-01-11 17:23:21.360 DEBUG (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Received data from: A1 2024-01-11 17:23:21.361 DEBUG (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Getting task list from Bambu Cloud for Printer: SERIALNUMBER 2024-01-11 17:23:21.410 DEBUG (MainThread) [custom_components.bambu_lab] _reinitialize_sensors START 2024-01-11 17:23:21.410 DEBUG (MainThread) [custom_components.bambu_lab] async_forward_entry_unload 2024-01-11 17:23:21.431 DEBUG (MainThread) [custom_components.bambu_lab] async_forward_entry_setup 2024-01-11 17:23:21.505 DEBUG (MainThread) [custom_components.bambu_lab] _reinitialize_sensors DONE 2024-01-11 17:23:21.595 DEBUG (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab] Manually updated bambu_lab data 2024-01-11 17:23:21.757 DEBUG (Thread-64) [custom_components.bambu_lab.pybambu] A1: SOCKET STATUS: 0 2024-01-11 17:23:23.367 DEBUG (Thread-62 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Received data from: A1 2024-01-11 17:23:23.766 DEBUG (Thread-64) [custom_components.bambu_lab] Manually updated bambu_lab data

AdrianGarside commented 8 months ago

Well that shows normal startup. The camera image thread successfully started and connected successfully to the printer. It should have been receiving the image data from that point onwards and sending it to HA.

Edit: Ignore this - got my wires crossed between the printer chamber image and the cover image. The log above doesn't go far enough to cover the querying of bambu cloud for last print data.

greghesp commented 8 months ago

If you right click the missing image, and copy the image URL, what does it show?

trwy7 commented 8 months ago

If you right click the missing image, and copy the image URL, what does it show?

https://DOMAIN.com/api/image_proxy/image.PRINTER_cover_image?token=TOKEN&state=2024-01-13T10:43:48.115168 The actual link shows a 500: internal server error, without the reverse proxy, I get ERR_SSL_PROTOCOL_ERROR

AdrianGarside commented 8 months ago

How is your HA setup configured to be accessed? I get http://:8123/api/image_proxy/... and I proxy myself so my external access is all to the :8123 port. Are you connecting from out of network in your entire usage?

trwy7 commented 8 months ago

How is your HA setup configured to be accessed? I get http://:8123/api/image_proxy/... Are you connecting from out of network in your entire usage?

Yes, except on mobile (seems counter intuitive, probably is). It goes Domain > nginx > home assistant

AdrianGarside commented 8 months ago

Unfortunately I think that's the problem. That indirection is somehow breaking access to the image. Is your chamber image broken too in the same way? I assume it must be given they're generated in-memory the same way for handoff to HA. In the integration we just hand the image bytes off to HA after that it's out of our control.

trwy7 commented 8 months ago

Unfortunately I think that's the problem. That indirection is somehow breaking access to the image. Is your chamber image broken too in the same way? I assume it must be given they're generated in-memory the same way for handoff to HA. In the integration we just hand the image bytes off to HA after that it's out of our control.

Nope, only cover image.

AdrianGarside commented 8 months ago

Well then, scratch that theory. Since the images are handle identically that means the download itself is presumably failing. There should be a log entries like this in the debug logs:

2024-01-14 22:37:08.829 DEBUG (Thread-4 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Getting latest task from Bambu Cloud for Printer: SERIAL
2024-01-14 22:37:08.829 DEBUG (Thread-4 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Getting task list from Bambu Cloud for Printer: SERIAL
2024-01-14 22:37:08.953 DEBUG (Thread-4 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Downloading cover image: https://bbl-prod-us-model.s3.dualstack.us-west-1.amazonaws.com/private/US8c71ea8cf18b02/41407571/3mf/Metadata/plate_1.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAXY6FH2ERKOLIVPHB%2F20240115%2Fus-west-1%2Fs3%2Faws4_request&X-Amz-Date=20240115T063708Z&X-Amz-Expires=60&X-Amz-SignedHeaders=host&X-Amz-Signature=1c5b7790af664212a62c232ac3cae76653c848375653c91fb4b6d791bfa292f2

If that's not present then the integration is not even attempting to do the download in which case something about your bambu login credentials isn't working.

AdrianGarside commented 8 months ago

Do you have correct print weight / length / bed type sensor values?

trwy7 commented 8 months ago

Do you have correct print weight / length / bed type sensor values?

Nope, all at 0

AdrianGarside commented 8 months ago

The connection to Bambu cloud is failing then. What Happens if you try to reconfigure the printer? It’s supposed to test the connection there and re request Bambu credentials if it cannot connect but that’s a little difficult to test.

AdrianGarside commented 7 months ago

Please reopen with more information.

trwy7 commented 7 months ago

I now have a P1S due to the recall, so I was forced to reconfigure. Nothing has changed

trwy7 commented 7 months ago

I cannot reopen

AdrianGarside commented 7 months ago

Seems like this is specific to your account then. Need you to check debug logs for any relevant errors/logging as you're starting a cloud print.

trwy7 commented 7 months ago

All i am seeing there is 2024-01-27 11:45:23.403 ERROR (Thread-14) [custom_components.bambu_lab.pybambu] A1: A Chamber Image thread outer exception occurred:

2024-01-27 11:45:20.331 ERROR (Thread-14) [custom_components.bambu_lab.pybambu] A1: Exception. Type: <class 'OSError'> Args: [Errno 113] Host is unreachable:

AdrianGarside commented 7 months ago

That would be the error if the IP address is wrong but local mqtt connection would also fail then. I see it still thinks your device is an A1 though - is that logging because your A1 is still configured in the integration?

trwy7 commented 7 months ago

That would be the error if the IP address is wrong but local mqtt connection would also fail then. I see it still thinks your device is an A1 though - is that logging because your A1 is still configured in the integration?

I see that, however it was already removed.

AdrianGarside commented 7 months ago

I would consider removing the integration completely and re-adding it. Something has gotten messed up in it's configuration at this point.

github-actions[bot] commented 5 months ago

Stale issue message

Spirituss commented 5 months ago

@AdrianGarside Have the same issue. Picture was shown successfully for quite a long time but stop working after HA upgrade to 2024.4.

AdrianGarside commented 5 months ago

Please can you provide debug logs.

Spirituss commented 5 months ago

Please can you provide debug logs.

I found this line in the HA error log:

ERROR (P1S-Chamber-215) [custom_components.bambu_lab.pybambu] Chamber image connection rejected by the printer. Check provided access code and IP address.

How can I treat it?

AdrianGarside commented 5 months ago

The instructions are in the readme file.

Spirituss commented 5 months ago

The instructions are in the readme file.

Do you mean the manual how to create diagnostics file?

AdrianGarside commented 5 months ago

No, the section right below it on how to enable the debug logs.

Spirituss commented 5 months ago

No, the section right below it on how to enable the debug logs.

Here it is home-assistant_bambu_lab_2024-04-24T17-08-14.025Z.log

AdrianGarside commented 5 months ago

The attempt to call the Bambu cloud API to retrieve the print image is getting an access denied error. Can you also provide the diagnostic log file?

Spirituss commented 5 months ago

The attempt to call the Bambu cloud API to retrieve the print image is getting an access denied error. Can you also provide the diagnostic log file?

config_entry-bambu_lab-51235f7846239b18c0c2013635706828 (1).json

AdrianGarside commented 5 months ago

I see you're in China - that API endpoint I cannot test. Are you still able to connect with your credentials if you reconfigure the plugin?

Spirituss commented 5 months ago

I see you're in China - that API endpoint I cannot test. Are you still able to connect with your credentials if you reconfigure the plugin?

I'm not in China, but the printer is China locked. I use user/pwd credentials for cloud connection. All other sensors and functions work well, both from HA and Bambu Studio / Handy. Only picture of the model doesn't work in the HA. Both cloud and LAN connection are activated in the HA integration.

trwy7 commented 5 months ago
2024-04-25 15:32:50.284 ERROR (Thread-7 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] A listener loop thread exception occurred:
2024-04-25 15:32:50.284 ERROR (Thread-7 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Exception. Type: <class 'struct.error'> Args: bad char in struct format
2024-04-25 15:32:51.285 WARNING (Thread-7 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] On Disconnect: Disconnected from Broker: 0
2024-04-25 16:25:53.316 WARNING (Thread-7 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] On Disconnect: Disconnected from Broker: 16
2024-04-25 16:25:53.772 WARNING (Thread-7 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] On Disconnect: Disconnected from Broker: 16

These are some notable logs from my home assistant

AdrianGarside commented 5 months ago

Yep, that happens sometimes. We get a truncated payload. I don't know if it's bad data from the printer or a bug in the mqtt library we use. It's not related to this issue.

AdrianGarside commented 5 months ago

I see you're in China - that API endpoint I cannot test. Are you still able to connect with your credentials if you reconfigure the plugin?

I'm not in China, but the printer is China locked. I use user/pwd credentials for cloud connection. All other sensors and functions work well, both from HA and Bambu Studio / Handy. Only picture of the model doesn't work in the HA. Both cloud and LAN connection are activated in the HA integration.

Unfortunately there's not much I can do to investigate this. Your credentials are being rejected by bambu connecting to the API endpoint that serves up the cover image (and other data about the print like print weight/length etc.). So, if the credentials the integration has are correct, they must have implemented additional requirements in the China region. You could try deleted and re-adding the integration from scratch to see if that helps but I suspect it won't.

AdrianGarside commented 5 months ago

My understanding is that a China region locked printer cannot connect to the Bambu cloud from an IP address outside of China. But it sounds like that’s not entirely true?

Spirituss commented 5 months ago

I see you're in China - that API endpoint I cannot test. Are you still able to connect with your credentials if you reconfigure the plugin?

I'm not in China, but the printer is China locked. I use user/pwd credentials for cloud connection. All other sensors and functions work well, both from HA and Bambu Studio / Handy. Only picture of the model doesn't work in the HA. Both cloud and LAN connection are activated in the HA integration.

Unfortunately there's not much I can do to investigate this. Your credentials are being rejected by bambu connecting to the API endpoint that serves up the cover image (and other data about the print like print weight/length etc.). So, if the credentials the integration has are correct, they must have implemented additional requirements in the China region. You could try deleted and re-adding the integration from scratch to see if that helps but I suspect it won't.

I deleted and added the integration again on one of my HA instances, and reconfigure the integration with the same data without its deletion before on the another instance. In both cases the picture restored successfully. I found another bug - the HA sensor shows nozzle type as “stainless steel” while the printer profile in a slicer has “brass” type.

AdrianGarside commented 5 months ago

The nozzle type comes from the printer, not the slicer. The printer only supports two nozzle types - stainless or hardened.

trwy7 commented 3 months ago

If any more info is needed, my printer is back up and running.