>>781
http://marlinfw.org/docs/gcode/M081.html

M81 - Power Off

Turn off the high-voltage power supply. If the board is not powered from another source, this may also shut down the electronics.

Usage
M81
Notes
Requires POWER_SUPPLY and a digital pin connected to the PSU’s enable pin.

このあたりを使うのが素直な感じがします