Runing python script with events

What is the problem?

Trying to run a python script with the "events" under "config.yaml" to trigger a bool in my S7-1200 that is then going to communicate with a UR 5e robot. But I can't get my raspberry pi to execute my python script.

What did you already try to solve it?

First of the documentation is kinda bad tryed to follow the example of the offical documentation Events β€” OctoPrint master documentation.
That made it only worse so when i copied that and restarted the system everything when wrong. I could not connect to the octoprint browser.

Then i tried the plugin "Action command". Did not work but I looked in the "config.yaml" file and saw that the plugin used "action" insteed of using the "event" so I tried that and it worked.
So now i can at least connect to the browser but I can't get it to work still.
I have provided the full file path to my python script but it does not change anything.

Additional information about your setup

OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible

Well we have a ZYYX Pro II printer, octoprint 1.6.0, Raspberry Pi 4 Model B Rev 1.1,

Remove the ~ from the front of the path of your script.

Thanks for your response. But sadly it have not changed anything. I have run a print for 10 min but it did not change anything.
I'm using a plugin called "Dryrun" so I don't waste print material. I don't know if that is interfering with it.

Well that was the first thing that was wrong, so at least it is now closer to working.
Try this:

events:
  enabled: True
  subscriptions:
  - event: PrintStarted
    command: python /home/pi/S71299_Test.py
    type: system
    enabled: true

I don't see action mentioned anywhere, these are events that you want to subscribe to.

Hi sorry for the late responde. We had to print a part but i have good news.
I copied your text and rebooted everything.
then it was up again it i checked the file and this is what i saw


The "command" had the "-" mark. did a test run and it worked!!!!!!! I got my signal in the S7-1200 now.
Thank you very much for your help

When the server saves the configuration, it orders everything alphabetically, in case you were wondering why it changed itself.

okay thanks