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)
perhaps you can implement this some time
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()
def requestWrite(self, node, file_name = None, filter_by_machine = False, file_handler = None, **kwargs):
self._gcode = getattr(Application.getInstance().getController().getScene(), "gcode_list")
Logger.log("d", "Check for psucontrol plugin ",self._psuState_reply)
self._psuState_reply = self._sendCommandToApi("plugin/psucontrol", "getPSUState")
Logger.log("d", "Turn Printer On command")
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