How can I react with RPI on a certain GCODE in OCTOPRINT

Hi all,
I am planning to control the IKEA RGB-LEDs.
I set up the RPI with a 4x relay ( I am not good in electronic parts, so I took the decent ones) :slight_smile:

I can control the GPIO (by wiringPi) and switch the relays. That works perfectly.
I added some GPIO instructions to the SETTINGS menu, to see if everything is ok, with the wiring

Question is:
How can I set a GPIO pin to high if the heat bed is on temperature?
How can I set a pin, if the printer is printing… or anything else possible

I am missing the following information:

  1. How can I react on a defined GCODE received by onto print
  2. or if the tis not possible, how can I generate (develop) a new event hook (Eventhandler) like the PRINT_FINISHED or similar events

So the chain is something like:

  1. printer reports a certain info (TEMP-REACHED, what ever) to the octoprint
  2. octoprint doing an action (setting GPIOpin on RPI) depending of the GCODE or event or action
  3. I am happy!!!

I went thru the doc and the source code but did not get the right sport for an entry.

If one could give me a hint, would be appreciated.

Thanks
Frank

Meanwhile I got a starting point from the Google group of Octoprint.
I am in it at the moment.

Will report back within next few weeks