Closed greendog99 closed 1 year ago
Upon closer examination, I think a missing layer_count
in the Gcode query is the root cause. It's causing an exception before layer_height
has a chance to be read:
11:46:57.447 ERROR (MainThread) [custom_components.moonraker] failed to get thumbnails {'layer_count'}
Thanks @greendog99 we will look at it and fix it soon
I dug into things a bit further. SuperSlicer puts ; total layers count = x
in the comments near the top of the gcode, and PrusaSlicer does not, so I added the following to my PrusaSlicer's Start G-code
section:
; total layers count = [total_layer_count]
The Moonraker API is now reporting layer_count
when querying file metadata. I restarted your integration while a new print was running, and all sensors are generated and are reporting.
I'm guessing maybe add a comment in the documentation advising to add this to the start gcode for non-SS users, and maybe a sanity check so the rest of the sensors still work if this value is missing?
Correction to my above comment -- the ; total layers count = [total_layer_count]
statement must be added to the End G-Code
section of PrusaSlicer, after PRINT_END
, since Moonraker looks for this text in the Gcode footer.
Version of the moonraker integration
0.8
Describe your setup
Voron 2.4R2 with Klipper 0.11.0, Moonraker 0.8.0, Mainsail, RPi3, PrusaSlicer, Home Assistant 2023.4.2.
Describe the bug
Home Assistant only creates printer controls (buttons and macros) and the Crow's Nest camera. No sensor entities are created (printer status, fan speed, etc.).
From the Traceback in the log below, it looks like
data["first_layer_height"]
anddata["layer_height"]
don't exist (NoneType
), which causes all sensor setup to fail.The full log is below, but the relevant error excerpt is:
which relates to:
https://github.com/marcolivierarsenault/moonraker-home-assistant/blob/f61c4eef47356c675761f86bb09512617904c3eb/custom_components/moonraker/sensor.py#L530-L534
I've recently switched from SuperSlicer to PrusaSlicer, so perhaps these variables are coded differently in PS? The debug log shows the Query Object gcode output does show the layer heights, but I'm not sure how the integration reads those:
2023-04-12 11:46:57.447 DEBUG (MainThread) [custom_components.moonraker] {'size': 8285384, 'modified': 1681308929.4305804, 'uuid': 'c1886d73-8bb0-4680-9c51-ff101a593169', 'slicer': 'PrusaSlicer', 'slicer_version': '2.6.0-alpha6+MacOS-arm64', 'gcode_start_byte': 43153, 'gcode_end_byte': 8275420, 'object_height': 31.8, 'estimated_time': 9457, 'nozzle_diameter': 0.4, 'layer_height': 0.3, 'first_layer_height': 0.3, 'first_layer_extr_temp': 200.0, 'first_layer_bed_temp': 60.0, 'filament_name': 'MDF PLA Voron', 'filament_type': 'PLA', 'filament_total': 26609.82, 'filament_weight_total': 65.92, 'thumbnails': [{'width': 32, 'height': 32, 'size': 1773, 'relative_path': '.thumbs/Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm-32x32.png'}, {'width': 300, 'height': 300, 'size': 28910, 'relative_path': '.thumbs/Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm-300x300.png'}], 'print_start_time': 1681308929.7732337, 'job_id': '00006C', 'filename': 'Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm.gcode'}
Love the integration, thanks for putting it together! Let me know if I can provide any additional data or do any testing.
Moonraker Logs