I think you misunderstand.
The two plugins I suggested are so that you can see how you could write your own plugin. You'll need to write a plugin for all this to work.
The reason I chose those two is because they do almost what you want to do; they hook into the part of OctoPrint where lines of GCODE are going to the printer. And that's what you need to do, too.
If it were me, I would do something like this:
- Remote into the Raspberry Pi
git clone --depth 1 https://github.com/kantlivelong/OctoPrint-GCodeSystemCommands.git Octo-Sync
rmdir -R .git
And then, edit everything throughout so that it stops being the original plugin and starts being yours. All references to his names need to be changed. His code which looks for "OCTO" needs to be replaced with your own functionality.
Much later, you'll want to
git init again in your folder to reintroduce another
.git hidden folder so that you can manage changes better and to even have your own repository at github.