@Luigisvc
Hello im working on klipper firmware. I want to auto shutdown the printer after completion of print but nothing works for me.
could you please share which the macro you use for your printer. might it will work for me.
[gcode_macro SHUTDOWN]
gcode:
{action_call_remote_method("shutdown_machine")}
If you added this macro and tried to call shutdown and nothing’s happens you have some permission problems or not loading your config, depending on your logs/response…
And if you just want to shut down after a print you can just call shutdown in your end gcode in your slicer or where ever have defined it. But care if you have printed parts on your hotend, then you should wait for cooldown before turning off the printer (Including fans)…
But sadly can not give more support on this.
@masterq
Hello
This macro code is not working for me. As i am using octoklipper i need a macrocode or similar to shutdown my printer after finishing the print. I am not using any TPlink smart plug or tasmota device for this and also do not want to use it.
Please help to resolve this issue.
After adding the gcode to your config file, must add a line calling CONDITIONAL_SHUTDOWN to either the PRINT_END macro in your printer.cfg or add it to the “End Gcode” setting in your slicer.
You must then call/execute the command SET_COMPLETE_SHUTDOWN in the klipper console either before or during the print.
@masterq Recent testing has shown that the behavior of printer.idle_timeout.printing_time was changed during a recent update. This value now seems to be set to 0.00 if the printer is paused long enough to trigger the idle_timeout, so the solution I proposed using this variable no longer works. Here is the new version of my SAFE_SHUTDOWN macro that I have been using for the last couple month to avoid the need for the extra Handler macros:
[gcode_macro SAFE_SHUTDOWN]
gcode:
{% if printer.idle_timeout.state|upper == "PRINTING" or printer.pause_resume.is_paused or printer.virtual_sdcard.is_active %}
M117 MSG="Job is active. No shutdown!"
{% else %}
M117 MSG="Performing safe shutdown"
SHUTDOWN
{% endif %}
You can remove the
... or printer.virtual_sdcard.is_active if you are not using the [virtual_sdcard] optional feature (it is enabled by default in mainsail.cfg, I don’t know if Fluid enables it as well). Technically checking printer.virtual_sdcard.is_active is redundant to checking printer.idle_timeout.state|upper == "PRINTING", but I left it in just in case there is some even more obscure edge-case that I missed in my testing.
I have been using a similar check for things such as conditionally parking the toolhead when I call LOAD_FILAMENT, so that it doesn’t trigger my _TOOLHEAD_PARK_LOAD_UNLOAD macro when I try to load new filament mid-print with the print paused.
Thank you for the reply.
I just want to ask that whether this code shuts down the raspberry pi or the entire 3D printer ???
You need special hardware to turn off the complete printer. There is no way to power of with software only. So this script triggers only shutdown of the PI.
However, it is possible to use the gpios of the PI to detect a shutdown and connect hardware to this PIN that disables the power supply. But this thread is the wrong place to ask for support about this. Read this for getting some hints: Providing Macrofile: Optionally shutdown after printing - #6 by masterq
@masterq
Thank you .
Hi I’m new and I need help. I saw your thread for shutdown. I have a flsun V400 and I don’t understand where I have to copy your code.
inside /home/pi/printer_data/config/
I created the shutdown.cfg file
I created the shutdown_menu.cfg file
I added in printer.cfg
SHUTDOWN Settings
[include shutdown.cfg]
[include shutdown_menu.cfg]
but the printer shows the error
“Section ‘menu __main __adv_shutdown’ is not a valid config section”
can you help me?
Thanks a lot