Call HTTP url on events : start, done

What is the problem?
I Need to call an http on events start and done

What did you already try to solve it?
I have searched inside all plugin, none seems to do what i need

Many thanks for your help, is there a modification i can make to do this ?

Here are the two events you're interested in. As described above this in the configuration section...

config.yaml:

events:
  enabled: True
  subscriptions:
  - event: PrintStarted
    command: ~/scripts/print-started {file}
    type: system
  - event: PrintDone
    command: ~/scripts/print-done {file}
    type: system

~/scripts/print-started:

#!/bin/sh

curl http://someserver.com/api/print-started/$1

...and don't forget to chmod the script(s) so that they're executable.

1 Like

That example script is a shell script, not a python script, but you are opening it with python.

1 Like

Ah, yes. (More coffee.) I edited it slightly above.

Many thanks for your help :slight_smile:

1 Like

Hi,
Thanks or your help !
I create a files ( print-started + print-started.sh , and print-done & print-done.sh )
When i start my print, no notification sent :confused:
When i test in cmd print-started, i works
i add a conf in config.yaml
Thanks for your help :wink:

There is a new plugin in the Repository: OctoPrint-Webhooks
Maybe this works for you as well.

I think I would recommend /home/pi/scripts/print-started as the path rather than the one with the tilde. You want to do an ls -l ~/scripts to confirm that the two files you've created have the executable flag in them.

Hello,
I am quite new in OctoPrint and not an Linux expert.
I would like to as end an URL request after the printing progress ended at 100% AND the rendering of time-laps were done.
I would like to use my FHEM home-automation for turning off the plug, where the printer is connected to. I can turn off the printer by requesting this url from my Windows PC:

http://192.168.178.20:8083/fhem?cmd.FS20ST_06=set%20FS20ST_06%20off&XHR=1&fwcsrf=csrf_559962721233202&fw_id=3022

I configured OctoPrint via GUI:
Eventmanager > Event "MovieDone" added (Command with curl {url]) / Type=system
but it still doesn't seem to work. Anything I missed?

But this isn’t working. Any hint about what to do?

Thanks for your help