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

Comments

  • There is no event for just sending a g-code. "sende bei Druckeraktivierung" is when it goes from "Deaktiviert" to "Aktiv" oder "Verbunden". 
    "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.
  • Just updated to 1.2.1 but can't find "printJobAdded" at printer settings, G-Codes, Ereignisabhängig.....
    Searching for "new server commands now available".... Did not find anything....

    Where can I write this function?
  • printJobAdded is not an event in the printer settings itself, it's a repetier event, which you can register a function to. To do that add in "Run on printer activation" the following code: 

    @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
Sign In or Register to comment.