M150 Command not executing

I've got an issue I'm trying to solve, and need some help. I built and set up a mount for a standard hobby servo to deploy a brush over the print bed, with the intent that when the extruder heats up, it makes a few passes over the brush to clean itself off before starting a print. The challenge I had, that I THOUGHT I had beat, is that the motherboard in my printer (Geeetech A30) has absolutely NO way to connect a servo to it to control it from the printer. So, after a few months of pondering and looking, I came across a Sparkfun Servo Trigger that handles the actual control and powering of the servo. It simply relies on a switch state also connected to it to control if it moves the servo to position A, or position B. So, I independently powered the Servo Trigger from it's own 5V power source, and then am using the RGB LED Light control plugin in Octoprint to control it. I connected I think it was physical pin 7 on the Pi's GPIO header to the input side in the Servo Trigger, and ground on the Pi GPIO header to the other side. I configured the plugin in Octoprint to only know about that pin, making it think it's controlling the Red LED's. So, issuing an M150 R0 (full off) command from the terminal homes the brush out of the way of the extruder and clear of the print bed, and M150 R255 (full on) deploys the brush out over the print bed ready for the cleaning passes. It runs beautifully from the terminal. So, I built the following command sequence into the print starting scripts of Simplify 3D thinking I had this licked, keyed to execute after the extruder has heated to temperature:

G1 Z30; (raise the extruder to the right height for cleaning)
M150 R255; (deploy the brush)
G1 X335; (first pass over the brush)
G1 X300; (second pass over the brush)
G1 X335; (third pass over the brush)
G1 X300; (fourth pass over the brush)
M150 R0; (home the brush out of the way)

In theory, it should work great, but it doesn't. All of the G commands get passed, but none of the M150 commands are executing. So, I thought OK, until I can figure this out (ya, right), I'll just monitor the printer and when it starts the cleaning cycle, I'll just issue the M150 commands from the terminal. No such luck - none of the M150 commands are passing out of the Pi. I sliced a small object and confirmed that the M150 commands are in the Gcode file. Any idea what I am missing here? Is there some trick I need to implement in the starting scripts to get it to pass the M150 commands to execute, instead of just being passed over? Help???

To control a servo, there is command M280: https://reprap.org/wiki/G-code#M280:_Set_servo_position

Thank you. I believe though, M280 depends on the servo being connected to the printer, and not to the Octopi. Using this method, I would think it should just set the state of physical pin 7 on the Pi (on or off), which the servo trigger would then read, causing the servo to move. Am I wrong?

I see - sorry for that misunderstanding.
You may insert a wait after the M150 to make sure that the servo reached it's position.
I think in the moment it is this way:
M150 R255 is executed,
all G1 commands are stuffed into the printer buffer
and the M150 R0 is executed.
The servo has no time to go to it's position.

I can't tell you how much I appreciate your helping! It's not a question of the servo having time to execute (it moves very fast), but you may have hit on what is happening. Perhaps the M150 commands are getting stuffed into the printer buffer, which has absolutely no idea what to do with them, rather than being executed by Octopi. Even with starting a print job on the Octopi, and then trying to manually execute the M150 commands at the right time, nothing happens, which says perhaps those commands are being passed straight through to the printer. I guess what I may need is some way to flag Octopi to basically say wait, that's a command for me to execute, not the printer?

If I want to do something Pi-side, I use the Gcode System Commands plugin, create something like OCTO800 and do the work locally in a Python script.

You know - I saw that plug-in, but passed it by - I think you may be on to something here. I can just create a simple python script to turn pin 7 on, then one to turn it off! Great idea - Thank you!

Just remember that those are running from the main Python thread and if you suspect that anything will block (like me trying to play sound events using aplay) then just make sure that your script runs it in the background.

If you're just toggling a pin you should be fine, though.