Prints (and timelapses) marked as failed even though they complete

What is the problem?

Prints (and timelapses) marked as failed even though they complete (red in list, failed on timelapse) I believe this is due to my M81 code which is the last line of my gcode (although seems commented code is appended following this by Cura) and turns off the printer (using Tuya plugin), but because octo doesnt see the entire print finish it gets marked as failed.

What did you already try to solve it?

Removing the M81 - works as expected

Have you tried running in safe mode?

No

What would you like the solution to be here? I don't see the problem, if the print never finishes because the printer is off then yeah that's a failure?

The print finishes. It's not failed, it completed.
M81 is the last line of the gcode and is a power off command - if M81 is in the code then expectation should be that the printer is wanted to turn off and therefore the print finished?

Just because OctoPrint sent the last command doesn't mean the printer is done. Those things have buffers, movement can take a while to finish. Your printer disconnecting before the print can be confirmed as done sounds a lot like "omg something broke". It's also a really bad idea to cut power to your printer right away. Give it a chance to let the fans run for a bit or you are just asking for a clogged nozzle due to heatcreep. There are plugins to automatically shut down your printer after some idle time without all these nasty side effects.

Yeah, you're right... my code gives clear indication and wait to cool down

G1 X0 Y{machine_depth} ;Present print

;Tell Bed and Hotend to Cool then Wait for them
M104 S40
M140 S45 ;bed to 45
M109 R40
M190 R45 ;bed to 45
;End of tell bed and hotend to cool and wait

M106 S0 ;Turn-off fan
M104 S0 ;Turn-off hotend
M140 S0 ;Turn-off bed
M84 X Y E ;Disable all steppers but Z

M81 192.168.1.xx ;power off tuya

Why use a plugin when a few lines of gcode in slicer will do?
Equally, a plugin isn't going to solve the issue that prints fail due to the last line of gcode...
And given that this uses a plugin to enact take action on the last line, shouldn't that be able to confirm the print is complete?

That still doesn't change the fact that if you cut power to the printer and thus make the serial connection fail, OctoPrint can't do the final print-finish check (specifically: Send an M400 to the printer to make sure it is really done, followed by a send queue marker that triggers the state change to "done") and thus can't verify that the print, in fact, is done. You are taking that possibility from it. If you want to cut power to the printer, make sure the serial line still stays operative until OctoPrint can actually confirm stuff is done. As things are, you are pulling the rug from under it. Don't.

The plugins I cited listen to that print done event, start a timer then, or start monitoring the temperature and shut off stuff once it's safe to do (and no new print has started).

Tuya smart plug (the plugin I am assuming you are using, if not then that would be a cool thing to mention) has a setting for 'Gcode off delay' which looks like it is a delay to power off the printer, after the gcode has been sent. Enable like 10 secs delay, all your gcode will be actioned and OctoPrint will send everything it needs to before the power is cut out.

From OctoPrint's perspective, if it hasn't sent all of the commands to finish the print, then the print failed to complete - there's no two ways of looking at it, since it is either yes, we did send them all or no we didn't.

Thanks - I'd missed that setting. That does the job

1 Like