Closed AdrianGarside closed 5 months ago
2024-01-19 14:20:10.149 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] GCODE_STATE: FINISH -> PREPARE 2024-01-19 14:20:10.149 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] GCODE_STATE: FINISH -> PREPARE 2024-01-19 14:20:10.149 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab] EVENT: event_print_started: {'device_id': 'a6d44b8813b975f182f9d070ae9e5208', 'type': 'event_print_started'} 2024-01-19 14:20:10.149 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] GENERATED START TIME: 2024-01-19 14:20:00 2024-01-19 14:20:10.149 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Getting latest task from Bambu Cloud for Printer: SERIAL 2024-01-19 14:20:10.149 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Getting task list from Bambu Cloud for Printer: SERIAL 2024-01-19 14:20:10.367 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Updating bambu cloud task data found for printer. 2024-01-19 14:20:10.367 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Downloading cover image: https://bbl-prod-us-model.s3.dualstack.us-west-1.amazonaws.com/...e7abc 2024-01-19 14:20:10.658 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] CLOUD START TIME1: 2024-01-19 14:20:00 2024-01-19 14:20:10.658 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] CLOUD START TIME2: 2024-01-19 14:20:04 2024-01-19 14:20:10.658 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] CLOUD END TIME1: 2024-01-19 14:06:00 2024-01-19 14:20:10.658 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] CLOUD END TIME2: 2024-01-19 14:20:05 2024-01-19 14:20:31.084 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] GCODE_STATE: PREPARE -> IDLE 2024-01-19 14:20:31.084 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] GCODE_STATE: PREPARE -> IDLE 2024-01-19 14:20:31.084 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] NEW USAGE HOURS: 0.0002777777777777778 2024-01-19 14:20:31.085 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab] OVERWRITING USAGE_HOURS WITH : 285.9827777777778 2024-01-19 14:20:35.189 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] GCODE_STATE: IDLE -> PREPARE 2024-01-19 14:20:35.189 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] GCODE_STATE: IDLE -> PREPARE 2024-01-19 14:20:35.189 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab] EVENT: event_print_started: {'device_id': 'a6d44b8813b975f182f9d070ae9e5208', 'type': 'event_print_started'} 2024-01-19 14:20:35.189 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] GENERATED START TIME: 2024-01-19 14:20:00 2024-01-19 14:20:35.189 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Getting latest task from Bambu Cloud for Printer: SERIAL 2024-01-19 14:20:35.189 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Getting task list from Bambu Cloud for Printer: SERIAL 2024-01-19 14:20:35.336 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Updating bambu cloud task data found for printer. 2024-01-19 14:20:35.336 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] Downloading cover image: https://bbl-prod-us-model.s3.dualstack.us-west-1.amazonaws.com/...bca91 2024-01-19 14:20:35.616 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] CLOUD START TIME1: 2024-01-19 14:20:00 2024-01-19 14:20:35.616 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] CLOUD START TIME2: 2024-01-19 14:20:04 2024-01-19 14:20:35.616 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] CLOUD END TIME1: 2024-01-19 14:20:05 2024-01-19 14:20:35.616 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] CLOUD END TIME2: 2024-01-19 14:20:28 2024-01-19 14:20:40.422 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] GCODE_STATE: PREPARE -> RUNNING 2024-01-19 14:20:40.422 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] GCODE_STATE: PREPARE -> RUNNING 2024-01-19 14:20:40.422 DEBUG (Thread-3 (mqtt_listen_thread)) [custom_components.bambu_lab.pybambu] END TIME2: 2024-01-19 16:23:00
The cause was a PREPARE -> IDLE transition shortly into the print process and not uniformly setting the start/end time for P1/A1 printers where we generate the start time (by observing the print starting) because, unlike the X1, it's not in the mqtt payload. That left us with an updated start time and the end time for the previous print (almost a day ago in my original repro). The fix I made was to fully use the cloud start/end time when it's available preferentially over the generated time. Which will fix the behavior with a bambu cloud connected integration. But printers that are connected to local mqtt and bambu credentials haven't been provided are likely still going to be exposed to this. So I probably need to set end time = start_time when generating the start time but the mqtt data might still overwrite that.
Describe the bug
The logs show the integration believed it observed two print starts back to back (<4s) and the first one was registered as 23.7 hours in duration!
To Reproduce
.
Expected Behaviour
.
What device are you using?
P1P
Diagnostic Output
Log Extracts
Other Information
No response