ha-bambulab
ha-bambulab copied to clipboard
[Bug] Since HACS 2.0 update, integration disconnects from printer broker when print finishes resulting in sensor values being erroneous which wreaks havoc on my automations
Describe the bug
Upon print finish (and likely other status, though I haven’t tested) the integration is disconnecting from the printer momentarily which is causing all the sensor values to temporarily become unavailable, then get set to what appears to be defaults, and finally getting set to the actual current values. I’m noticing this behavior because I have automations that revolve around bed temperature, chamber temperature, total layer count, etc. As you can imagine this sort of behavior essentially renders my previously perfectly working automations completely useless.
To Reproduce
Just send a print to the printer and let things happen as they should.
Expected Behaviour
Expected behavior is for the integration certainly to not disconnect from the printer and if it happens to definitely not haphazardly set default values for no good reason.
What device are you using?
X1C
Diagnostic Output
{
"home_assistant": {
"installation_type": "Home Assistant OS",
"version": "2024.8.3",
"dev": false,
"hassio": true,
"virtualenv": false,
"python_version": "3.12.4",
"docker": true,
"arch": "x86_64",
"timezone": "America/New_York",
"os_name": "Linux",
"os_version": "6.6.46-haos",
"supervisor": "2024.08.0",
"host_os": "Home Assistant OS 13.1",
"docker_version": "26.1.4",
"chassis": "vm",
"run_as_root": true
},
"custom_components": {
"bambu_lab": {
"documentation": "https://github.com/greghesp/ha-bambulab",
"version": "2.0.22",
"requirements": []
},
"webrtc": {
"documentation": "https://github.com/AlexxIT/WebRTC",
"version": "v3.5.2",
"requirements": []
},
"fontawesome": {
"documentation": "https://github.com/thomasloven/hass-fontawesome",
"version": "2.2.1",
"requirements": []
},
"govee": {
"documentation": "https://github.com/LaggAt/hacs-govee/blob/master/README.md",
"version": "2023.11.1",
"requirements": [
"govee-api-laggat==0.2.2",
"dacite==1.8.0"
]
},
"tesla_custom": {
"documentation": "https://github.com/alandtse/tesla/wiki",
"version": "3.24.1",
"requirements": [
"teslajsonpy==3.12.0"
]
},
"weatherflow_forecast": {
"documentation": "https://github.com/briis/weatherflow_forecast",
"version": "1.0.9",
"requirements": [
"pyweatherflow-forecast==1.0.11"
]
},
"scrypted": {
"documentation": "https://www.home-assistant.io/integrations/scrypted",
"version": "0.0.9",
"requirements": []
},
"midea_ac_lan": {
"documentation": "https://github.com/georgezhao2010/midea_ac_lan#readme",
"version": "v0.3.22",
"requirements": []
},
"hacs": {
"documentation": "https://hacs.xyz/docs/configuration/start",
"version": "2.0.0",
"requirements": [
"aiogithubapi>=22.10.1"
]
}
},
"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.9379999997681807e-05
},
"3036056aa8c6ea760ad2f69e21648ef8": {
"wait_import_platforms": -0.23121852000000231,
"wait_base_component": -0.0007044430000000546,
"config_entry_setup": 0.2431305960000003,
"config_entry_platform_setup": 0.0050849839999997926
}
},
"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": "3036056aa8c6ea760ad2f69e21648ef8",
"minor_version": 1,
"modified_at": "2024-09-01T21:35:46.103813+00:00",
"options": {
"region": "NorthAmerica",
"email": "**REDACTED**",
"username": "**REDACTED**",
"name": "3DP-00M-418",
"host": "192.168.3.200",
"local_mqtt": true,
"auth_token": "**REDACTED**",
"access_code": "**REDACTED**",
"usage_hours": 92.59999999999997
},
"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": "33.5",
"tray": [
{
"bed_temp": "35",
"bed_temp_type": "1",
"cali_idx": -1,
"cols": [
"61C680FF"
],
"ctype": 0,
"drying_temp": "55",
"drying_time": "8",
"id": "0",
"nozzle_temp_max": "230",
"nozzle_temp_min": "190",
"remain": 100,
"tag_uid": "9C27BC5400000100",
"tray_color": "61C680FF",
"tray_diameter": "1.75",
"tray_id_name": "A01-G1",
"tray_info_idx": "GFA01",
"tray_sub_brands": "PLA Matte",
"tray_type": "PLA",
"tray_uuid": "52FB393EE5C94995B25F957E456BD5F6",
"tray_weight": "1000",
"xcam_info": "8813D007E803E803CDCC4C3F"
},
{
"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": 8,
"tag_uid": "5C0ABD5400000100",
"tray_color": "000000FF",
"tray_diameter": "1.75",
"tray_id_name": "A01-K1",
"tray_info_idx": "GFA01",
"tray_sub_brands": "PLA Matte",
"tray_type": "PLA",
"tray_uuid": "AAF28870CF7B4A24935FA6490985DFB9",
"tray_weight": "1000",
"xcam_info": "A4388813E803E803CDCC4C3F"
},
{
"bed_temp": "35",
"bed_temp_type": "1",
"cali_idx": -1,
"cols": [
"000000FF"
],
"ctype": 0,
"drying_temp": "55",
"drying_time": "8",
"id": "2",
"nozzle_temp_max": "230",
"nozzle_temp_min": "190",
"remain": 96,
"tag_uid": "EC2A7A9500000100",
"tray_color": "000000FF",
"tray_diameter": "1.75",
"tray_id_name": "A01-K1",
"tray_info_idx": "GFA01",
"tray_sub_brands": "PLA Matte",
"tray_type": "PLA",
"tray_uuid": "E00A57503EF34E50B3BAD2FE5CF30982",
"tray_weight": "1000",
"xcam_info": "A4388813E803E803CDCC4C3F"
},
{
"bed_temp": "35",
"bed_temp_type": "1",
"cali_idx": -1,
"cols": [
"9B9EA0FF"
],
"ctype": 0,
"drying_temp": "55",
"drying_time": "8",
"id": "3",
"nozzle_temp_max": "230",
"nozzle_temp_min": "190",
"remain": 80,
"tag_uid": "5CF22E9400000100",
"tray_color": "9B9EA0FF",
"tray_diameter": "1.75",
"tray_id_name": "A01-D3",
"tray_info_idx": "GFA01",
"tray_sub_brands": "PLA Matte",
"tray_type": "PLA",
"tray_uuid": "ABC0188EBD164CA8BF3766F51882CAA1",
"tray_weight": "1000",
"xcam_info": "D007D007E803E8030000803F"
}
]
}
],
"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": 9544
},
"ams_rfid_status": 0,
"ams_status": 0,
"aux_part_fan": true,
"bed_target_temper": 0.0,
"bed_temper": 33.0,
"big_fan1_speed": "0",
"big_fan2_speed": "0",
"cali_version": 0,
"chamber_temper": 37.0,
"command": "push_status",
"cooling_fan_speed": "0",
"ctt": 0,
"device": {
"fan": 0,
"nozzle": {
"0": {
"info": 8,
"temp": 38
},
"info": 41
}
},
"fail_reason": "0",
"fan_gear": 0,
"filam_bak": [
6
],
"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": 6409600,
"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": "126013490",
"layer_num": 25,
"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": 3355683008,
"mask": 16777215
},
{
"ip": 0,
"mask": 0
}
]
},
"nozzle_diameter": "0.4",
"nozzle_target_temper": 0.0,
"nozzle_temper": 38.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": "cloud",
"profile_id": "114923299",
"project_id": "122994719",
"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": "244671128",
"subtask_name": "foldable phone holder stand print in place V2",
"task_id": "244671127",
"total_layer_num": 25,
"upgrade_state": {
"ahb_new_version_number": "",
"ams_new_version_number": "",
"consistency_request": false,
"dis_state": 3,
"err_code": 0,
"ext_new_version_number": "",
"force_upgrade": false,
"idx": 4,
"idx1": 2,
"lower_limit": "00.00.00.00",
"message": "verifying: filament",
"module": "",
"new_version_state": 2,
"ota_new_version_number": "",
"progress": "100",
"sequence_id": 0,
"sn": "**REDACTED**",
"status": "UPGRADE_SUCCESS"
},
"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": "-49dBm",
"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": 3,
"hw_ver": "N/A",
"name": "ota",
"sn": "**REDACTED**",
"sw_ver": "01.08.02.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.39"
}
],
"sequence_id": "2057"
}
}
}
Log Extracts
Here is what is logged in HA’s logs at the exact time a print finishes..
This error originated from a custom integration.
Logger: custom_components.bambu_lab.pybambu
Source: custom_components/bambu_lab/pybambu/bambu_client.py:397
integration: Bambu Lab (documentation, issues)
First occurred: August 30, 2024 at 7:27:44 PM (3 occurrences)
Last logged: 5:35:46 PM
On Disconnect: Disconnected from Broker: 16
On Disconnect: Disconnected from Broker: 0
This error originated from a custom integration.
Logger: custom_components.bambu_lab.pybambu
Source: custom_components/bambu_lab/pybambu/bambu_client.py:401
integration: Bambu Lab (documentation, issues)
First occurred: August 30, 2024 at 7:27:44 PM (3 occurrences)
Last logged: 5:35:46 PM
_on_disconnect
This error originated from a custom integration.
Logger: custom_components.bambu_lab.pybambu
Source: custom_components/bambu_lab/pybambu/bambu_client.py:405
integration: Bambu Lab (documentation, issues)
First occurred: August 30, 2024 at 7:27:44 PM (3 occurrences)
Last logged: 5:35:46 PM
Stopping watchdog thread
Also worth mentioning.. I now get the following errors in HA as well, but they’re not tied to a print finishing, they appear constantly (related to the camera) and upon first layer inspection…
logger:%20homeassistant.components.stream.stream.camera.x1c_00m09a410301418_camera%0ASource%3A%20components/stream/__init__.py:448%0Aintegration:%20Stream%20(documentation,%20issues)%0AFirst%20occurred:%204:01:22%20PM%20(59%20occurrences)%0ALast%20logged:%206:35:57%20PM%0A%0AError%20from%20stream%20worker:%20Error%20opening%20stream%20(ERRORTYPE_5,%20I/O%20error,%20rtsps://****:****@192.168.3.200:322/streaming/live/1)
This error originated from a custom integration.
Logger: custom_components.bambu_lab.pybambu
Source: custom_components/bambu_lab/pybambu/models.py:1171
integration: Bambu Lab (documentation, issues)
First occurred: 4:59:46 PM (1 occurrences)
Last logged: 4:59:46 PM
HMS ERRORS: {'Count': 1, '1-Error': 'HMS_0C00_0300_0003_000B: Inspecting the first layer: please wait a moment.', '1-Wiki': 'https://wiki.bambulab.com/en/x1/troubleshooting/hmscode/0C00_0300_0003_000B', '1-Severity': 'common'}
### Other Information
The printer has stable Wi-Fi and has not disconnected for any reason from the AP in days.