Automatic Power on and start printing?

Hi,
I am using psucontrol for powering up my printer (switching 230V). octopi has its own supply.
i modified psucontrol to connect my printer after powered up.
As the octoprint plugin on cura watches the state ...and this is offline i cant send anything to octoprint.

is there a possibility with a plugin to alter the states of the printer in octoprint? ( like standby)

when i changed cura to accept the offline state it transfers the data to octoprint. (there is an error ..the printer doesnt accept commands)

is it possible somewhere to get the info of uploading and trigger a power on?
would it be an idea to create a virtual printer and queue the commands to it and transfer to the then powered up printer? how could this be handled with multi printer support?

Christian

No way that I can think of. The state of "Offline" is also valid if OctoPrint is not connected to your controller.

Depending on the controller used you may be able to supply power to keep logic(5/3.3v) up which would keep the connection open. Easy to go from there.

This is the method that I use and it works well. With the Smoothieboard/SBASE, the 5V it gets from being plugged into the Pi over USB keeps the logic running and the connection....connected. The Pi and thus the controller are always on. I use PSU Control to switch the high-voltage line going into the controller that supplies the steppers and heaters. My Start G-code in slic3r looks like this:

M80 ; turn mains power on
G28 ; home all axes
M190 S[first_layer_bed_temperature] ; wait while bed comes up to temperature
G1 Z5 F5000 ; drop the nozzle
M109 S[first_layer_temperature] ; wait while hot end comes up to temperature

I use PSU Control's timeout configuration to turn off the high-voltage side after 10-minutes idle.

Thanks for your post.... im almost there what i want.. i found that you already implemented the api in your plugin.
one thing i am missing from your plugin is that it can automatic connect to the printer on power on

        if self.sensingMethod not in ('GPIO','SYSTEM'):
            self._noSensing_isPSUOn = True
     
        time.sleep(0.1 + self.postOnDelay)
             self._printer.connect(port="/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0",baudrate=115200)
            
        self.check_psu_state()

perhaps you can implement this some time :wink:
it would also be interesting if the CONNECTING event also fires, if you press connect and the printer is powered off... because than it would be also possible to power on on connect. and power off on disconnect.

than i have to hack the octoprint plugin from cura
i have changed the write request so that it first powers on the machine and then after some time proceed with the upload and start to print ..this is already working
one thing i would like to do is to check somehow for the presence of the plugin and if its not available to return to normal behavior.
i tried this with the getPSUState but i cant get it to work.

    self._printer_on_timer = QTimer()
    self._printer_on_timer.setSingleShot(True)
    self._printer_on_timer.timeout.connect(self.startPrint)

def requestWrite(self, node, file_name = None, filter_by_machine = False, file_handler = None, **kwargs):
    self.writeStarted.emit(self)
    self._gcode = getattr(Application.getInstance().getController().getScene(), "gcode_list")

    self.checkPsucontrol()
    self.turnOnPrinter()
    #self.startPrint()


def checkPsucontrol(self):
    Logger.log("d", "Check for psucontrol plugin ",self._psuState_reply)
    self._psuState_reply = self._sendCommandToApi("plugin/psucontrol", "getPSUState")


def turnOnPrinter(self):
    self._sendCommandToApi("plugin/psucontrol", "turnPSUOn")
    Logger.log("d", "Turn Printer On command")
    self._printer_on_timer.setInterval(15000)
    self._printer_on_timer.start()

def turnOffPrinter(self):
    self._sendCommandToApi("plugin/psucontrol", "turnPSUOff")
    Logger.log("d", "Turn Printer Off command")

if i power the controller the display and the fan is always running. so this is no option

Christian

I typically suggest using the PortLister plugin for autoconnect.

Briefly looking at PrinterOutputDevice.py it looks like _sendCommandToApi() does not return anything but instead updates the variable self._command_reply

Hi, I run into trouble with the PSU control... my goal is to launch a print via Astroprint. The whole thing works fine if my printer is powered on permanently. Of course the next step is add PSU control. I made a little relay installed the plugin, I get the little lighting symbol and can turn the printer on and off in Octoprint.
When I enable the automatically turn on functionality and try the homing command in Octoprint, I would expect the PSU to turn on first however nothing happens. The only way is to first press the lightning symbol, then connect to the printer and only then my printer is operational (from Octopint and Astroprint). This obviously requires me to be on my home network. If these two steps could be done automatically, I could launch my prints via the internet...
Feel like I am running in a squirrel cage here :dizzy_face: any help would be very much appreciated!!