Retrieve a command displayed in the Terminal window

Hello
I am looking to retrieve the information from an order that appears in the terminal.
For example, I would like to retrieve the command G1 Z + 20 in order to stop the printer because on detection of the end of the filament the printer waits for nozzle and bed in heating, but if the problem monitors at night the printer can stay for hours in this state, I prefer to be able to turn it off.
Do you know a Plugin which allows to retrieve the info and to be able to execute behind for example a Gcode
Thank you

It sounds like you're saying...

  • you get a filament runout condition, say, at night
  • when this happens, some script runs which includes something like G1 Z+20 or similar
    • when this happens, you want to do something like M104 S0, M140 S0, M107

You might consider triggering from the runout condition instead. There may be a way of incorporating a G4 (dwell) command for some number of seconds so that you could deal with it during the day... and then if you're not there at night, shut off heat.

More precisely
I incorporated the G5 code in my Gcode following the Anycubic recommendation for a resumption on power failure, I do not know if this code is determining for a lack of filament by test what I note is that when I simulate a filament failure on a print launched on my Octoprint SD card goes up the code G1 Z20 +
The firmware should I think send the stop command and raise the head pending change of filament, but leaves the bed and the head warm, I wanted that when this code is detected that the machine cuts the temperature of the bed and the head

thank

come back to my comment actually this is what I want to do (with the commands (M104 M107 etc ..) I need to check if Octoprint can interpret the pause when printing via SD card and that there is a end of filament. I'm going to check that, if Octiprint sees the pause effectively, I can insert the commands in the Gcode script (Pause.)

I make the requests and the answers :grin: but I wanted to check, On Octiprint in the Terminal we do not recover the stop and the pause we just see the code G91 Z-50 appear.
Hence the idea of ​​recovering a Gcode
Like if you see the code G91 execute this GCODE or maybe there is a pluggin that does it but I haven't seen anything about it
Thanks, have a good day

Perhaps someone else knows how to do this. :crossed_fingers:

I am revisiting an old plugin subject for a filament sensor. my printer an anycubic chiron does not take into account the gcode M600. but manages very well an end of filament when printing on an SD card. to do nothing inventing again I was wondering to intercept the code that takes place at the time of the end of the filament to reproduce it in the pause Gcode of an Octoprint plugin managing a filament sensor? So is there a way to see the code that is running on my printer?

When printing from the SD card, you will not be able to find out what commands the printer is sending.

If you print from USB, then there is this plugin:

Merci pour la réponse j'ai chargé le plugin réécrire M600 et effectivement maintenant sur la commande M600 la tête se relève ,je pourrais donc insérer M600 dans le code à exécuter lors de la détection de fin de filament par un plugin de gestion de filament exemple filament sensor simplified. Ou cela s'avère plus compliqué que cela