Connect via python script


#1

I have my Octoprint set up with a few system commands that run python scripts to turn on/off led lights, and turn the printer on/off.

So my Pi is powered from the printers power supply (which is always on), and then I have the power to the printer ran through a relay that is controlled by a GPIO. That all works great, but I want to add one feature.

Once I click the power on under system commands, I also want it to connect to the printer (as it of course loses the connect when the printer is shut off.)

Is there a command that I can execute via python script to tell it to attempt a connection to the USB serial port on my printer? So far my research has come up empty.


#2

The PortLister plugin might be useful, if not to use as is then to see how they do it:


#3

Yes! Exactly what I wanted. Works great! I figured something was out there - I just couldn't seem to find it for some reason.

Thanks much!