Is there a plugin to run python scripts on specific GCODE?

I was searching for a plugin that could run some python, or even bash, scripts when a specific GCODE command from a print is read.
Here is my idea so you can understand better: I connected some mosfet to the GPIO of the RPi in order to turn on some 12V LEDs, and I wrote some python scripts in order to turn them on using the Enclosure Plugin and Printoid for Android smartphones. I'd like to, for example, to turn on the red LED (running the script) when the printer bed and hot end is heating up, it should be (if I'm not wrong) the M109 command. Or run another script when the print starts.
Is there any plugin that can do this?

I'm not aware of any generic gcode processing plugin, but it is possible for sure. My TPLink-Smartbulb plugin incorporates monitoring for specific rgb gcode and will change the color of the bulb based on the command parameters.

Just did a search though and you could use this plugin I think.

And you could also probably use this, and let the plugin do the work.

Thank you, I will try them out!

I use the Gcode System Commands plugin and it works great for Pi-side coding.

Perfect man, GCODE System Commands works like a charm! LEDStripControl, instead, looks like a tiny version of Enclosure Plugin just for LED, and it's not for me.
Thank you!

Thank you, this is the plugin I was searching for! But jneilliii gave me the solution before, so I gave it the check. Sorry!

It's alright, I get checks once per week from my contract. (ba dum tss)

Octoprint supports also REST i did it this way

EDIT not pretty nice, but an example :slight_smile:
https://bitbucket.org/linuxpaul/octoprint-servicepanel/src/master/

LEDStripControl has been abandoned.

Doesn't necessarily mean it doesn't still work.

Won't work with my LED ring:-(

Is that ws281x based, might want to use the other plugin for that.

yes it is.

Yeah, check out the ws281x plugin, very advanced and made specifically to work with those types of LED "strips".

After many screw ups, got it working.