ha-bambulab
ha-bambulab copied to clipboard
[Bug] Integration writes data every 5 seconds, even when printer is off
Describe the bug
Today, when looking at some of the graphs generated by the integration, that when my printer was offline (it only runs so often), the flat line of the graph had data points every 5 seconds. In other integrations (e.g. my ZigBee device), when a device is offline, the line is indeed flat, but does not have any data points.
I don't think it makes much sense to add data points every 5 seconds for a device that's offline. It makes my database grow larger and larger without a good reason, which is not a great thing to have if you're storing your HA DB on a device which has limited write cycles to begin with.
To Reproduce
- Fire up your printer
- Make it do some stuff
- Turn it off
- After a while, notice the flat line of any graph keeps making data entries every 5 seconds
Expected Behaviour
No added data entries when device is offline.
What device are you using?
X1C
Diagnostic Output
{
"home_assistant": {
"installation_type": "Home Assistant Core",
"version": "2024.6.2",
"dev": false,
"hassio": false,
"virtualenv": true,
"python_version": "3.12.3",
"docker": false,
"arch": "aarch64",
"timezone": "Europe/Amsterdam",
"os_name": "Linux",
"os_version": "6.1.21-v8+",
"run_as_root": false
},
"custom_components": {
"bambu_lab": {
"documentation": "https://github.com/greghesp/ha-bambulab",
"version": "2.0.22",
"requirements": []
},
"smart_thermostat": {
"documentation": "https://github.com/ScratMan/HASmartThermostat",
"version": "2021.11.1",
"requirements": []
},
"mhz19": {
"documentation": "https://www.home-assistant.io/integrations/mhz19",
"version": "1.0",
"requirements": [
"pmsensor==0.4"
]
},
"generic_thermostat": {
"documentation": "https://www.home-assistant.io/integrations/generic_thermostat",
"version": "2021.9.7",
"requirements": []
},
"thermal_comfort": {
"documentation": "https://github.com/dolezsa/thermal_comfort/blob/master/README.md",
"version": "2.2.2",
"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": {},
"data": {
"config_entry": {
"data": {
"device_type": "X1C",
"serial": "**REDACTED**"
},
"disabled_by": null,
"domain": "bambu_lab",
"entry_id": "e6d3495d8449f60b64fa2ab827c73a50",
"minor_version": 1,
"options": {
"region": "",
"email": "",
"username": "",
"name": "",
"host": "192.168.178.203",
"local_mqtt": true,
"auth_token": "",
"access_code": "**REDACTED**",
"usage_hours": 85.74999999999999
},
"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": "21.1",
"tray": [
{
"bed_temp": "0",
"bed_temp_type": "0",
"cali_idx": -1,
"cols": [
"161616FF"
],
"ctype": 0,
"drying_temp": "0",
"drying_time": "0",
"id": "0",
"nozzle_temp_max": "280",
"nozzle_temp_min": "240",
"remain": -1,
"tag_uid": "0000000000000000",
"tray_color": "161616FF",
"tray_diameter": "0.00",
"tray_id_name": "",
"tray_info_idx": "GFB99",
"tray_sub_brands": "",
"tray_type": "ABS",
"tray_uuid": "00000000000000000000000000000000",
"tray_weight": "0",
"xcam_info": "000000000000000000000000"
},
{
"bed_temp": "0",
"bed_temp_type": "0",
"cali_idx": -1,
"cols": [
"2850E0FF"
],
"ctype": 0,
"drying_temp": "0",
"drying_time": "0",
"id": "1",
"nozzle_temp_max": "270",
"nozzle_temp_min": "220",
"remain": -1,
"tag_uid": "0000000000000000",
"tray_color": "2850E0FF",
"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": [
"00000000"
],
"ctype": 0,
"drying_temp": "70",
"drying_time": "8",
"id": "2",
"nozzle_temp_max": "220",
"nozzle_temp_min": "190",
"remain": 25,
"tag_uid": "1C8C9F5400000100",
"tray_color": "00000000",
"tray_diameter": "1.75",
"tray_id_name": "S05-C0",
"tray_info_idx": "GFS05",
"tray_sub_brands": "Support for PLA",
"tray_type": "PLA-S",
"tray_uuid": "00000000000000000000000000000000",
"tray_weight": "250",
"xcam_info": "000000000000000000000000"
},
{
"bed_temp": "0",
"bed_temp_type": "0",
"cali_idx": -1,
"cols": [
"F72323FF"
],
"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": "F72323FF",
"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": "1",
"tray_pre": "1",
"tray_read_done_bits": "f",
"tray_reading_bits": "0",
"tray_tar": "1",
"version": 21
},
"ams_rfid_status": 2,
"ams_status": 768,
"aux_part_fan": true,
"bed_target_temper": 70.0,
"bed_temper": 70.0,
"big_fan1_speed": "0",
"big_fan2_speed": "10",
"cali_version": 0,
"chamber_temper": 37.0,
"command": "push_status",
"cooling_fan_speed": "7",
"ctt": 0,
"device": {
"fan": 55200,
"nozzle": {
"0": {
"info": 136,
"temp": 16711935
},
"info": 231
}
},
"fail_reason": "0",
"fan_gear": 11796582,
"filam_bak": [],
"force_upgrade": false,
"gcode_file": "/data/Metadata/plate_1.gcode",
"gcode_file_prepare_percent": "100",
"gcode_state": "RUNNING",
"heatbreak_fan_speed": "13",
"hms": [],
"home_flag": 6407583,
"hw_switch_state": 1,
"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": 16,
"lights_report": [
{
"mode": "on",
"node": "chamber_light"
},
{
"mode": "flashing",
"node": "work_light"
}
],
"maintain": 3,
"mc_percent": 55,
"mc_print_error_code": "0",
"mc_print_stage": "2",
"mc_print_sub_stage": 0,
"mc_remaining_time": 56,
"net": {
"conf": 16,
"info": [
{
"ip": 3417483456,
"mask": 16777215
},
{
"ip": 0,
"mask": 0
}
]
},
"nozzle_diameter": "0.4",
"nozzle_target_temper": 255.0,
"nozzle_temper": 255.0,
"nozzle_type": "hardened_steel",
"online": {
"ahb": false,
"ext": false,
"version": 4
},
"print_error": 0,
"print_gcode_action": 0,
"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": 0,
"subtask_id": "0",
"subtask_name": "TopLeft",
"task_id": "9856",
"total_layer_num": 33,
"upgrade_state": {
"ahb_new_version_number": "",
"ams_new_version_number": "",
"consistency_request": false,
"dis_state": 0,
"err_code": 0,
"ext_new_version_number": "",
"force_upgrade": false,
"idx": 4,
"idx1": 0,
"lower_limit": "00.00.00.00",
"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": [
"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": "-67dBm",
"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": "20010"
}
}
}
Log Extracts
No response
Other Information
No response