How to Pause/Resume via MQTT?

what is the topic, Rest API, and Rest parameter to do Pause and Resume?
i searched and found nothing about the syntax of these. thanks!

This is cut out from a python script which handles an OctoPrint remote: You'll need to edit the API key and the url to your OctoPrint print host.

def sendOctoPrintCommand(cmd):
    
    if   cmd == "restart":
        payload = '{"command": "restart"}'
    elif cmd == "cancel":
        payload = '{"command": "cancel"}'
    elif cmd == "pause":
        payload = '{"command": "pause", "action":"pause"}'
    elif cmd == "resume":
        payload = '{"command": "pause", "action":"resume"}'
    elif cmd == "togglePause":
        payload = '{"command": "pause", "action":"toggle"}'
    
    command = 'curl -s -X POST  -H "Content-Type: application/json" -H "X-Api-Key":"ABCDEF1234567890ABC" -d \'{}\' http://octoprint.athome/api/job'.format(payload)
    #print(command)
    stream = os.popen(command)
    response=stream.read()
    #print(response)

See also the docs: Job operations β€” OctoPrint master documentation

this works for PAUSE

this works for Resume:

thank you everyone!!!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.