Enclosure plugin integrate into Octoprint Anywhere?

First off THANK YOU for this platform. I am new into this, only a couple of months, and while I have wrestled with my printer, Octoprint has always performed wonderfully.

I am using the Enclosure plugin to control an external 4 relay device using the Pi's GPIO pins.

I have 2 questions and one may not be directly Octoprint related.

First, is there anyway to integrate the on/off controls from the Enclosure plugin into Octoprint Anywhere? While it is great for me to watch and stop my print through this means, it would really be great to be able to hit what I have as the power and shut off the printer for safety and all that.

Second, Is there a way to code in the g code of the print that at the end of the print to turn off the printer using this same GPIO pin?

Thanks for all help and hints!