greghesp / ha-bambulab

A Home Assistant Integration for Bambu Lab Printers
696 stars 58 forks source link

[Feature] Catch non HMS error codes #525

Open LRomandine opened 1 month ago

LRomandine commented 1 month ago

Describe the feature

Add ability to read generic errors from the machine (list of errors)

These error codes are currently not reported to HA in any way I can see. Checking the Developer Tools -> States -> my printer I do not see any sensor picking up the error. Orcaslicer and Bambu Handy both pick it up.

What device is this for?

X1C

Other Information

Here is the output of all my x1c sensors. I encountered error 0500 4008 which you can see is not listed at all.

Current entities
Entity  State   Attributes

binary_sensor.x1c_redacted_enclosure_door
Bambu X1C Enclosure door
    off     device_class: door
friendly_name: Bambu X1C Enclosure door
binary_sensor.x1c_redacted_firmware_update
Bambu X1C Firmware update
    off     device_class: update
friendly_name: Bambu X1C Firmware update
binary_sensor.x1c_redacted_hms_errors
Bambu X1C HMS errors
    off     Count: 0
device_class: problem
friendly_name: Bambu X1C HMS errors
binary_sensor.x1c_redacted_online
Bambu X1C Online
    on  device_class: running
friendly_name: Bambu X1C Online
binary_sensor.x1c_redacted_recording_timelapse
Bambu X1C Recording timelapse
    off     device_class: running
icon: mdi:camera
friendly_name: Bambu X1C Recording timelapse
button.x1c_redacted_force_refresh_data
Bambu X1C Force Refresh Data
    2024-05-01T21:18:38.684059+00:00    icon: mdi:refresh
friendly_name: Bambu X1C Force Refresh Data
button.x1c_redacted_pause_printing
Bambu X1C Pause printing
    unknown     icon: mdi:pause
friendly_name: Bambu X1C Pause printing
button.x1c_redacted_resume_printing
Bambu X1C Resume printing
    unavailable     icon: mdi:play
friendly_name: Bambu X1C Resume printing
button.x1c_redacted_stop_printing
Bambu X1C Stop printing
    unknown     icon: mdi:stop
friendly_name: Bambu X1C Stop printing
camera.x1c_redacted_camera
Bambu X1C Camera
    recording   access_token: redacted
brand: Bambu Lab
frontend_stream_type: hls
entity_picture: /api/camera_proxy/camera.x1c_redacted_camera?token=redacted
icon: mdi:camera
friendly_name: Bambu X1C Camera
supported_features: 2
fan.x1c_redacted_aux_fan
Bambu X1C Aux fan
    off     preset_modes: null
percentage: 0
percentage_step: 1
preset_mode: null
friendly_name: Bambu X1C Aux fan
supported_features: 1
fan.x1c_redacted_chamber_fan
Bambu X1C Chamber fan
    off     preset_modes: null
percentage: 0
percentage_step: 1
preset_mode: null
friendly_name: Bambu X1C Chamber fan
supported_features: 1
fan.x1c_redacted_cooling_fan
Bambu X1C Cooling fan
    off     preset_modes: null
percentage: 0
percentage_step: 1
preset_mode: null
friendly_name: Bambu X1C Cooling fan
supported_features: 1
light.x1c_redacted_chamber_light
Bambu X1C Chamber light
    on  supported_color_modes: onoff
color_mode: onoff
icon: mdi:led-strip-variant
friendly_name: Bambu X1C Chamber light
supported_features: 0
select.x1c_redacted_printing_speed
Bambu X1C Printing speed
    standard    options: silent, standard, sport, ludicrous
icon: mdi:speedometer
friendly_name: Bambu X1C Printing speed
sensor.x1c_redacted_active_tray
Bambu X1C Active tray
    unavailable     friendly_name: Bambu X1C Active tray
sensor.x1c_redacted_active_tray_index
Bambu X1C Active tray index
    unavailable     friendly_name: Bambu X1C Active tray index
sensor.x1c_redacted_ams_1_ams_temperature
Bambu AMS AMS temperature
    26.0    state_class: measurement
unit_of_measurement: °C
device_class: temperature
friendly_name: Bambu AMS AMS temperature
sensor.x1c_redacted_ams_1_humidity_index
Bambu AMS Humidity index
    3   state_class: measurement
icon: mdi:water-percent
friendly_name: Bambu AMS Humidity index
sensor.x1c_redacted_ams_1_tray_1
Bambu AMS Tray 1
    Bambu ASA   active: false
empty: false
color: #2140B4FF
name: Bambu ASA
nozzle_temp_min: 240
nozzle_temp_max: 270
remain: 49
tag_uid: C0DFC25E00000100
type: ASA
icon: mdi:printer-3d-nozzle
friendly_name: Bambu AMS Tray 1
sensor.x1c_redacted_ams_1_tray_2
Bambu AMS Tray 2
    Generic PLA     active: false
color: #7C4B00FF
empty: false
name: Generic PLA
nozzle_temp_min: 190
nozzle_temp_max: 240
remain: -1
tag_uid: 0000000000000000
type: PLA
icon: mdi:printer-3d-nozzle
friendly_name: Bambu AMS Tray 2
sensor.x1c_redacted_ams_1_tray_3
Bambu AMS Tray 3
    Generic PLA     active: false
color: #7C4B00FF
empty: false
name: Generic PLA
nozzle_temp_min: 190
nozzle_temp_max: 240
remain: -1
tag_uid: 0000000000000000
type: PLA
icon: mdi:printer-3d-nozzle
friendly_name: Bambu AMS Tray 3
sensor.x1c_redacted_ams_1_tray_4
Bambu AMS Tray 4
    Bambu ASA   active: false
color: #000000FF
empty: false
name: Bambu ASA
nozzle_temp_min: 240
nozzle_temp_max: 270
remain: 73
tag_uid: DEF20A7300000100
type: ASA
icon: mdi:printer-3d-nozzle
friendly_name: Bambu AMS Tray 4
sensor.x1c_redacted_aux_fan_speed
Bambu X1C Aux fan speed
    0   state_class: measurement
unit_of_measurement: %
friendly_name: Bambu X1C Aux fan speed
sensor.x1c_redacted_bed_temperature
Bambu X1C Bed temperature
    20  state_class: measurement
unit_of_measurement: °C
device_class: temperature
friendly_name: Bambu X1C Bed temperature
sensor.x1c_redacted_chamber_fan_speed
Bambu X1C Chamber fan speed
    0   state_class: measurement
unit_of_measurement: %
friendly_name: Bambu X1C Chamber fan speed
sensor.x1c_redacted_chamber_temperature
Bambu X1C Chamber temperature
    24  state_class: measurement
unit_of_measurement: °C
device_class: temperature
friendly_name: Bambu X1C Chamber temperature
sensor.x1c_redacted_cooling_fan_speed
Bambu X1C Cooling fan speed
    0   state_class: measurement
unit_of_measurement: %
friendly_name: Bambu X1C Cooling fan speed
sensor.x1c_redacted_current_layer
Bambu X1C Current layer
    0   friendly_name: Bambu X1C Current layer
sensor.x1c_redacted_current_stage
Bambu X1C Current stage
    idle    options: paused_nozzle_temperature_malfunction, homing_toolhead, paused_heat_bed_temperature_malfunction, paused_front_cover_falling, paused_nozzle_clog, idle, paused_user_gcode, m400_pause, checking_extruder_temperature, auto_bed_leveling, paused_nozzle_filament_covered_detected, printing, cleaning_nozzle_tip, calibrating_motor_noise, calibrating_extrusion_flow, sweeping_xy_mech_mode, motor_noise_showoff, paused_first_layer_error, paused_ams_lost, cooling_chamber, filament_unloading, paused_cutter_error, calibrating_extrusion, inspecting_first_layer, identifying_build_plate_type, paused_user, paused_skipped_step, paused_low_fan_speed_heat_break, calibrating_micro_lidar, paused_chamber_temperature_control_error, changing_filament, heating_hotend, unknown, filament_loading, paused_filament_runout, scanning_bed_surface, heatbed_preheating, offline
device_class: enum
friendly_name: Bambu X1C Current stage
sensor.x1c_redacted_end_time
Bambu X1C End time
    unavailable     friendly_name: Bambu X1C End time
sensor.x1c_redacted_gcode_filename
Bambu X1C Gcode filename
    /data/Metadata/plate_1.gcode    icon: mdi:cloud-outline
friendly_name: Bambu X1C Gcode filename
sensor.x1c_redacted_heatbreak_fan_speed
Bambu X1C Heatbreak fan speed
    0   state_class: measurement
unit_of_measurement: %
friendly_name: Bambu X1C Heatbreak fan speed
sensor.x1c_redacted_mqtt_connection_mode
Bambu X1C MQTT connection mode
    local   options: bambu_cloud, local
device_class: enum
friendly_name: Bambu X1C MQTT connection mode
sensor.x1c_redacted_nozzle_size
Bambu X1C Nozzle size
    0.4     unit_of_measurement: mm
device_class: distance
friendly_name: Bambu X1C Nozzle size
sensor.x1c_redacted_nozzle_target_temperature
Bambu X1C Nozzle target temperature
    0   state_class: measurement
unit_of_measurement: °C
device_class: temperature
friendly_name: Bambu X1C Nozzle target temperature
sensor.x1c_redacted_nozzle_temperature
Bambu X1C Nozzle temperature
    23  state_class: measurement
unit_of_measurement: °C
device_class: temperature
friendly_name: Bambu X1C Nozzle temperature
sensor.x1c_redacted_nozzle_type
Bambu X1C Nozzle type
    hardened_steel  friendly_name: Bambu X1C Nozzle type
sensor.x1c_redacted_print_progress
Bambu X1C Print progress
    0   state_class: measurement
unit_of_measurement: %
friendly_name: Bambu X1C Print progress
sensor.x1c_redacted_print_status
Bambu X1C Print status
    running     options: failed, finish, idle, init, offline, pause, prepare, running, slicing, unknown, offline
device_class: enum
friendly_name: Bambu X1C Print status
sensor.x1c_redacted_print_type
Bambu X1C Print type
    cloud   options: local, cloud, system, idle, unknown
device_class: enum
icon: mdi:cloud-outline
friendly_name: Bambu X1C Print type
sensor.x1c_redacted_remaining_time
Bambu X1C Remaining time
    0   unit_of_measurement: min
device_class: duration
friendly_name: Bambu X1C Remaining time
sensor.x1c_redacted_speed_profile
Bambu X1C Speed profile
    standard    options: silent, standard, sport, ludicrous
modifier: 100
device_class: enum
friendly_name: Bambu X1C Speed profile
sensor.x1c_redacted_start_time
Bambu X1C Start time
    2024-05-09 09:00:00     friendly_name: Bambu X1C Start time
sensor.x1c_redacted_target_bed_temperature
Bambu X1C Target Bed temperature
    0   state_class: measurement
unit_of_measurement: °C
device_class: temperature
friendly_name: Bambu X1C Target Bed temperature
sensor.x1c_redacted_task_name
Bambu X1C Task name
    redacted_print_name     icon: mdi:cloud-outline
friendly_name: Bambu X1C Task name
sensor.x1c_redacted_total_layer_count
Bambu X1C Total layer count
    253     friendly_name: Bambu X1C Total layer count
sensor.x1c_redacted_total_usage
Bambu X1C Total usage
    1129.52     unit_of_measurement: h
friendly_name: Bambu X1C Total usage
sensor.x1c_redacted_wi_fi_signal
Bambu X1C Wi-Fi signal
    -47     state_class: measurement
unit_of_measurement: dBm
device_class: signal_strength
friendly_name: Bambu X1C Wi-Fi signal
AdrianGarside commented 1 month ago

binary_sensor.x1c_redacted_hms_errors Bambu X1C HMS errors off Count: 0

It's not being reported as an HMS error by the printer since the count of HMS errors is zero (HMS error details is in attributes on that sensor). See #515 for another case where a previously reported HMS error is now a transient state in the mqtt payloads.

LRomandine commented 1 month ago

The Bambu site says it is not a HMS error but just "error code". I was hoping Bambu exposed the error codes in MQTT under the 'print_error' or 'mc_print_error_code' fields.

According to this post, print_error should correlate to an error code from list of non-HMS error codes.

AdrianGarside commented 1 month ago

For #515 they set the value into the print_error field instead of the previous HMS error. But I think it's only there transiently. However, I haven't dug into that yet to confirm.

Thanks for the wiki link, that helps me understand a bit better how they're viewing the two overlapping ways to report problems. It's just a shame they aren't consistent. The print_error value for print canceled is definitely transient.

The integration has a download diagnostics button on the device. That will download information that includes the latest full mqtt payload. So that will help with cases like this as we can see if the data we need to improve the experience is present.

LRomandine commented 1 month ago

I manually caused an error by holding a spool in my AMS during a print and it worked, print_error was 117473286 (hex 07008006)

config_entry-bambu_lab-1618f47626cba3029574c51853e08c00.json

I downloaded the diagnostic file again after a few minutes and print_error was still there. After fixing the issue and hitting "retry" on the X1 touchscreen the print resumed. I downloaded the diagnostic file again and print_error was 0 and THEN my notification for HMS fired. In my file I uploaded HMS is blank so it looks like Bambu surfaces the print_error and when it clears it surfaces the HMS error.

AdrianGarside commented 1 month ago

Thanks. That’s very useful. And that new HMS behavior is bizarre.