Automatically load file on startup

I'm currently building a headless glueing machine using Octoprint. The operator will not have access to the web interface, and ideally, the Pi won't be connected to Wifi at all. There is a physical Start button (using Octoprint Enclosure) to start a "print," but I cannot find a way to automatically load (but not run) a file when Octoprint starts up.

Every search I've performed just leads to posts about automatically loading or starting a print from a newly uploaded file.

I'm sure this could be done with a script, but I know exactly nothing about creating and running a python script.

Thanks in advance! You are awesome!

You could update the autoselect plugin probably to get this to work on octoprint startup event instead of file upload event. The problem would be how to choose which file to select if you're not getting a handle on the "file added" event.

The line here in the code is actually doing the work.

1 Like

There will only be one file, so it could probably just call it by filename. Can you help me understand what I'm looking at in the code? I don't really know what that line means, or how to change it.

That line is documented here. It does look like you could use just a string for the filename. Then you just change the events the plugin is monitoring.

1 Like

I'm sorry. I just don't understand the code or what changes are needed. I've read the information you linked but I don't know how to use that information to do what I want. I dabble with Arduino, but I know absolutely nothing about python.

Here....if you look at the code at the link below you'll see that I changed to monitor the CONNECTED event and forced the filename of the gcode to autoprint.gcode basically stored in the root of the uploads folder. If that file is not there the plugin will throw errors in the log.

If you find that helpful, maybe you'll send me a tip...

1 Like

And honestly, it sounds like if you have an operator you're running a business of this. I'd suggest contracting with someone (perhaps jneilliii) and have them set you up with a solution. As a business, you'd want the comfort of knowing that an expert is there to support you.

1 Like

Got it working. Not really sure what was going on, but whenever I installed it I ended up with @foosel's version. I ended up having to duplicate your repository and change all of the links to the duplicated repository I created.

Thank you!

Yeah, I didn't update any of the install urls or anything, just the core code was changed in that separate branch. For future reference, you can install using the url for "download zip" from the active branch from github in plugin manager. It's found under the clone or download button.


Thanks again for the tip.

That was the first way I tried installing it, but it still installed the original code. I won't rule out me doing something wrong (because I screw up simple things all the time), but I don't think I did this time. It didn't install correctly until I duplicated the repository and updated the links in and _, then installed from the archive link. :man_shrugging: