Control octoprint from printer?

Is there already a way to pause/continue/abort/restart a print directly from the printer menu? That would be really handy since I often don't have my notebook/phone nearby or running when taking a look at the current messed up print. I'm thinking of a new menu section in marlin that would send serial commands and thus trigger events in octoprint. Is there a protocol/specification for data pushed from the printer (like those temperature updates) and is it possible to process these in a plugin?

Klipper can do something like that. At least, I've seen the option on my own printer.

Yep, see here:

Yeah, got it. Here is my complete solution (since there is no native "start job" command):

  1. Python script to execute Octoprint API calls

OCTOPRINT_URL = 'http://localhost:5001/api/'
API_KEY = '***'

import requests
import sys

port = sys.argv[1]
headers = {'X-Api-Key': API_KEY}
json = {
  "command": sys.argv[1]
r =
        OCTOPRINT_URL + "job",

if (r.status_code == 204):
    json = {
      "command": "M117 Octo \"" + sys.argv[1] + "\" done."
    json = {
      "command": "M117 Octo \"" + sys.argv[1] + "\" failed."

r =
        OCTOPRINT_URL + "printer/command",
  1. Custom Action commands plugin Setup:
action: octo_start |  type: system | command: /path/to/ start
action: octo_cancel |  type: system | command: /path/to/ cancel
  1. Marlin Configuration_adv.h
  #define USER_SCRIPT_DONE "M117 User Script Done"
  #define USER_SCRIPT_RETURN  // Return to status screen after a script

  #define USER_DESC_1 "Octoprint Cancel"
  #define USER_GCODE_1 "M118 //action:octo_cancel"

  #define USER_DESC_2 "Octoprint Start"
  #define USER_GCODE_2 "M118 //action:octo_start"