greghesp / ha-bambulab

A Home Assistant Integration for Bambu Lab Printers
1.05k stars 94 forks source link

AMS custom filaments unknown #466

Closed Phrede closed 1 month ago

Phrede commented 9 months ago

Describe the bug

When a custom filament is loaded it is displayed as "unknown" in the integration.

To Reproduce

Create and load a custom filament in the AMS

Expected Behaviour

Display the name given to the custom filament

What device are you using?

X1C

Diagnostic Output

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2024.2.1",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.12.1",
    "docker": true,
    "arch": "x86_64",
    "timezone": "America/New_York",
    "os_name": "Linux",
    "os_version": "6.1.74-haos",
    "supervisor": "2024.01.1",
    "host_os": "Home Assistant OS 11.5",
    "docker_version": "24.0.7",
    "chassis": "vm",
    "run_as_root": true
  },
  "custom_components": {
    "pfsense": {
      "version": "0.1.0",
      "requirements": [
        "mac-vendor-lookup>=0.1.11"
      ]
    },
    "hass_agent_notifier": {
      "version": "2022.10.25.1",
      "requirements": []
    },
    "blueiris": {
      "version": "1.0.16",
      "requirements": []
    },
    "bambu_lab": {
      "version": "2.0.14",
      "requirements": []
    },
    "webrtc": {
      "version": "v3.5.1",
      "requirements": []
    },
    "hass_agent_mediaplayer": {
      "version": "2022.5.6",
      "requirements": []
    },
    "ipcamlive": {
      "version": "0.0.1",
      "requirements": []
    },
    "weatheralerts": {
      "version": "0.1.5",
      "requirements": []
    },
    "frigate": {
      "version": "5.0.1",
      "requirements": [
        "pytz==2022.7"
      ]
    },
    "browser_mod": {
      "version": "2.3.0",
      "requirements": []
    },
    "zha_toolkit": {
      "version": "v1.1.8",
      "requirements": [
        "pytz"
      ]
    },
    "pfsense_gateways": {
      "version": "1.1.1",
      "requirements": []
    },
    "hass_agent": {
      "version": "2022.11.9",
      "requirements": []
    },
    "dahua": {
      "version": "0.5.0",
      "requirements": []
    },
    "rpi_gpio": {
      "version": "2022.7.0",
      "requirements": [
        "RPi.GPIO==0.7.1"
      ]
    },
    "asusrouter": {
      "version": "0.28.0",
      "requirements": [
        "asusrouter==1.6.1"
      ]
    },
    "alexa_media": {
      "version": "4.9.0",
      "requirements": [
        "alexapy==1.27.10",
        "packaging>=20.3",
        "wrapt>=1.14.0"
      ]
    },
    "weatherflow_forecast": {
      "version": "1.0.8",
      "requirements": [
        "pyweatherflow-forecast==1.0.11"
      ]
    },
    "hpprinter": {
      "version": "1.0.12",
      "requirements": [
        "xmltodict==0.12.0"
      ]
    },
    "watchman": {
      "version": "0.5.1",
      "requirements": [
        "prettytable==3.0.0"
      ]
    },
    "hacs": {
      "version": "1.34.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.14",
    "is_built_in": false
  },
  "data": {
    "config_entry": {
      "entry_id": "a390b9577358c420ae14569d2235a3a9",
      "version": 2,
      "minor_version": 1,
      "domain": "bambu_lab",
      "title": "**REDACTED**",
      "data": {
        "device_type": "X1C",
        "serial": "**REDACTED**"
      },
      "options": {
        "region": "",
        "email": "",
        "username": "",
        "name": "",
        "host": "10.1.1.XX",
        "local_mqtt": true,
        "auth_token": "",
        "access_code": "**REDACTED**",
        "usage_hours": 39.24
      },
      "pref_disable_new_entities": false,
      "pref_disable_polling": false,
      "source": "user",
      "unique_id": null,
      "disabled_by": null
    },
    "push_all": {
      "ams": {
        "ams": [
          {
            "humidity": "5",
            "id": "0",
            "temp": "21.0",
            "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": "270",
                "nozzle_temp_min": "220",
                "remain": -1,
                "tag_uid": "0000000000000000",
                "tray_color": "161616FF",
                "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": [
                  "FFFFFFFF"
                ],
                "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": "FFFFFFFF",
                "tray_diameter": "0.00",
                "tray_id_name": "",
                "tray_info_idx": "P5ba7064",
                "tray_sub_brands": "",
                "tray_type": "PETG",
                "tray_uuid": "00000000000000000000000000000000",
                "tray_weight": "0",
                "xcam_info": "000000000000000000000000"
              },
              {
                "bed_temp": "35",
                "bed_temp_type": "1",
                "cali_idx": -1,
                "cols": [
                  "00AE42FF"
                ],
                "ctype": 0,
                "drying_temp": "55",
                "drying_time": "8",
                "id": "2",
                "nozzle_temp_max": "230",
                "nozzle_temp_min": "190",
                "remain": -1,
                "tag_uid": "EC0CFA3B00000100",
                "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": "E093DB0563114B0BB39DCE5606AFC4B8",
                "tray_weight": "250",
                "xcam_info": "88138813E803E8039A99193F"
              },
              {
                "bed_temp": "0",
                "bed_temp_type": "0",
                "cali_idx": -1,
                "cols": [
                  "BCBCBCFF"
                ],
                "ctype": 0,
                "drying_temp": "0",
                "drying_time": "0",
                "id": "3",
                "nozzle_temp_max": "270",
                "nozzle_temp_min": "220",
                "remain": -1,
                "tag_uid": "0000000000000000",
                "tray_color": "BCBCBCFF",
                "tray_diameter": "0.00",
                "tray_id_name": "",
                "tray_info_idx": "Pe8e9ebc",
                "tray_sub_brands": "",
                "tray_type": "PETG",
                "tray_uuid": "00000000000000000000000000000000",
                "tray_weight": "0",
                "xcam_info": "000000000000000000000000"
              }
            ]
          }
        ],
        "ams_exist_bits": "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": 61
      },
      "ams_rfid_status": 0,
      "ams_status": 0,
      "aux_part_fan": true,
      "bed_target_temper": 0.0,
      "bed_temper": 17.0,
      "big_fan1_speed": "0",
      "big_fan2_speed": "0",
      "cali_version": 0,
      "chamber_temper": 20.0,
      "command": "push_status",
      "cooling_fan_speed": "0",
      "ctt": 0,
      "fail_reason": "0",
      "fan_gear": 0,
      "filam_bak": [],
      "force_upgrade": false,
      "gcode_file": "",
      "gcode_file_prepare_percent": "0",
      "gcode_start_time": "0",
      "gcode_state": "IDLE",
      "heatbreak_fan_speed": "0",
      "hms": [],
      "home_flag": 6407552,
      "hw_switch_state": 0,
      "ipcam": {
        "ipcam_dev": "1",
        "ipcam_record": "enable",
        "mode_bits": 2,
        "resolution": "1080p",
        "rtsp_url": "**REDACTED**",
        "timelapse": "disable",
        "tutk_server": "disable"
      },
      "job_id": "",
      "layer_num": 0,
      "lifecycle": "product",
      "lights_report": [
        {
          "mode": "on",
          "node": "chamber_light"
        },
        {
          "mode": "flashing",
          "node": "work_light"
        }
      ],
      "maintain": 3,
      "mc_percent": 0,
      "mc_print_error_code": "0",
      "mc_print_stage": "1",
      "mc_print_sub_stage": 0,
      "mc_remaining_time": 0,
      "mess_production_state": "active",
      "net": {
        "conf": 16,
        "info": [
          {
            "ip": 587268362,
            "mask": 16777215
          },
          {
            "ip": 0,
            "mask": 0
          }
        ]
      },
      "nozzle_diameter": "0.4",
      "nozzle_target_temper": 0.0,
      "nozzle_temper": 19.0,
      "nozzle_type": "hardened_steel",
      "online": {
        "ahb": false,
        "ext": false,
        "version": 7
      },
      "print_error": 0,
      "print_gcode_action": 0,
      "print_real_action": 0,
      "print_type": "",
      "profile_id": "",
      "project_id": "",
      "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": [],
      "stg_cur": -1,
      "subtask_id": "",
      "subtask_name": "",
      "task_id": "",
      "total_layer_num": 0,
      "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": 7,
        "message": "",
        "module": "null",
        "new_version_state": 0,
        "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": [
          "161616FF"
        ],
        "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": "161616FF",
        "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": "-28dBm",
      "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": [
        {
          "hw_ver": "",
          "name": "ota",
          "sn": "",
          "sw_ver": "01.07.02.00"
        },
        {
          "hw_ver": "AP05",
          "name": "rv1126",
          "sn": "**REDACTED**",
          "sw_ver": "00.00.28.55"
        },
        {
          "hw_ver": "TH09",
          "name": "th",
          "sn": "**REDACTED**",
          "sw_ver": "00.00.07.12"
        },
        {
          "hw_ver": "MC07",
          "name": "mc",
          "sn": "**REDACTED**",
          "sw_ver": "00.00.22.37/00.00.22.37"
        },
        {
          "hw_ver": "",
          "name": "xm",
          "sn": "",
          "sw_ver": "00.01.02.02"
        },
        {
          "hw_ver": "AMS08",
          "name": "ams/0",
          "sn": "**REDACTED**",
          "sw_ver": "00.00.06.40"
        }
      ],
      "sequence_id": "20004"
    }
  }
}

Log Extracts

No response

Other Information

No response

ZeldoKavira commented 9 months ago

The custom names are saved in Bambu Studio and not on the printer so there is no way for the integration to read them

mwLabs-eu commented 8 months ago

The custom names are saved in Bambu Studio and not on the printer so there is no way for the integration to read them

It looks like, the names are also saved on the Printer itself. When you enable sync in settings, create a custom filament and check on the printer, it is also listed on the printer itself. There are also the PA Values shown when choosing the filament on the printer.

damole1984 commented 7 months ago

The Custom Filaments are stored in the printer or AMS. I can choose them on the Screen of the X1C without my PC turned on. It would be great if these could be shown in the Intgeration, but i think this could be impossible because the value of the sensor is "unknown"

github-actions[bot] commented 5 months ago

Stale issue message

t3chguy commented 4 months ago

Its a real shame that even though the printer knows the Vendor & Name of the custom filament given you can pick it on the touchscreen that the API sends only an empty string. Some way of configuring this would be super appreciated. Even more so if you can pick the AMS & slot and just provide a name and it stores the underlying idx along with the local name. Don't mind setting it up and forgetting it, UI > config

kurim commented 4 months ago

@t3chguy as you can see here the API of bambu provide the info: https://github.com/greghesp/ha-bambulab/issues/540#issuecomment-2186383233 But it need to grab by the integration.

t3chguy commented 4 months ago

Oh nice, I missed that thanks

Indeed I can confirm the data is present there

image

t3chguy commented 4 months ago

I'm going to try whip something up

https://github.com/greghesp/ha-bambulab/compare/main...t3chguy:ha-bambulab:t3chguy/custom-filaments

t3chguy commented 4 months ago

Aaaand it works!

image

damole1984 commented 4 months ago

Glad to hear, great! Do you know when the Update will roll out via HACS?

t3chguy commented 4 months ago

It has to merge first, there was some review given to the PR yesterday I will hopefully iterate today/tomorrow, then its up to when the maintainers release it. @damole1984 you could have it right now on my fork if you'd like: https://github.com/t3chguy/ha-bambulab