Switch printer + light if G-Code is sent to printer
I want to switch printer and light on if somebody sends a print to that printer using the web-frontend.
No matter, whether printer is on or off, usb voltage avail or not, printer-processor running or not.
Printers are "red" in webfront.
I tried "Ereignisabhängig -> sende bei Druckeraktivierung" or "Sende vor einem Druckauftrag" with in Printer's G-Codes, but this does not work.
Code I put at "Printer-Activation" and "Send before print"
@execute Mini_Ein (works when sent from printer console even if printer is off)
@setTimer 0
@waitForTimer 30
@setTimer 0
@waitForTimer 30
Comments
"Sende vor einem Druckauftrag" is when you start a print.
Next release will have printJobAdded event that gets triggered when you upload a job to queue. You can write a function that gets called for that event in "sende bei Druckeraktivierung" and add a event monitor to trigger the function. See new server commands now available.
@func runGcodeAdded
@execute Mini_Ein
@setTimer 0
@waitForTimer 30
@endfunc
@callOnEvent "printJobAdded" runGcodeAdded
and in "Run on printer deactivation":
@removeCallOnEvent "printJobAdded" runGcodeAdded
You can find a list of events in our API documentation and all server commands in our manual or in the quick help when you click the button "Show help" in the Gcode settings