Auto shutdown not working as expected #53
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This plugin is great. I use it all the time and it's nice to know my printer will shut down after I have gone to bed! ;-)
I understand how auto shutdown works, but there is a pretty common scenario where it does something unexpected. Say, you have auto shutdown set for 500 seconds after print completes. These steps will cause a problem:
If you are using it to turn the PSU on and off (which is a fairly common set up), your second print job will fail because the shut down. You can manually start up the PSU again, but by that time the print has been messed up and things are out of sync.
Is it possible to cancel the outstanding shut down timers when a new job is started?
I'll fix this issue on next release.
This happens to me as well, I have the printer's PSU routed through a relay switch and RPI is powered from a separate PSU. Thanks for looking into it, please update this thread when you have updates. Props for the addon, it works fantastic otherwise!
I love that plugin and I have the same problem. I use a Pi Zero and I have auto shutdown disabled
I have the same setup as @elfhelmp mentioned, and I've lost track of how many prints have been destroyed due to this. :( Other than that, I love the plugin!
One additional quirk I've found:
If I reconfigure the plugin not to shutdown after a print, if I do that after a print, it'll still shut down.
For example:
I think disabling a shutdown timer in the config should cancel any that are pending.
I also wonder if starting a new print should cancel any pending scheduled things? Is there any scenario where that would be undesirable?
I'm a software developer (though not in Python) so I thought I would look through the code and see if I could understand enough to submit a PR for this. I found a couple interesting things while I was doing that.
From the code, it looks like it already tries to cancel any scheduled job when a print starts?
https://github.com/vitormhenrique/OctoPrint-Enclosure/blob/master/octoprint_enclosure/init.py#L642-L643
From reading the Python docs, I wonder if the reason this doesn't work could be because of the
scheduler.run()inelif event in (Events.PRINT_DONE, Events.PRINT_FAILED, Events.PRINT_CANCELLED):?The docs (https://docs.python.org/2/library/sched.html#sched.scheduler.run) say:
I wonder if after a print finishes, the
scheduler.run()sits there an runs, waiting the 500 seconds until the shutdown event, and because of that, theif event == Events.PRINT_STARTED:doesn't fire?I think I fixed this on the dev branch, if anyone can change branches and help me test I would appreciate.
I can try and help, I just don't know how to do it. Can you provide instructions for how I can help test?
I just changed the entire architecture of the plugin on the development branch, but still need to update the methods to comply with the new model.
I'm hopping by the weekend I'll have a test build ready.
I just finished re-writing most of the plugin and implemented this requested feature, tested 95% of the plugin.
If you want to test it out uninstall the current plugin, go to the plugin manager, select get more, and where it says "from URL" use the development branch:
https://github.com/vitormhenrique/OctoPrint-Enclosure/archive/dev.zip
More documentation here:
https://github.com/vitormhenrique/OctoPrint-Enclosure/tree/dev
I'll push this to production after more people test it out.
Fixed on 4.0