I have an Ender 5 and run it with Octoprint (web GUI via Raspberry Pi)
I've added a relay to the printer, which sits between the PSU and the mainboard. There is a plugin to Octoprint called 'PSU control' which allows turning the printer on and off via a GPIO pin. I had to build a small circuit board with transistor to get this going consistently (as per this: https://gpailler.github.io/2018-03-02-octoprint-psucontrol/) but anyhow, it all works ok.
As well as feeding the main board, I also have the relay feeding a buck converter, dropping the voltage to 5V which the output then runs to some LED lights on the printer (so when the printer turns on, the lights turn on, printer off, turns lights off) Fairly straight forward.
However, the issue I have is the USB connection (that sits between RPi and mainboard) is back feeding voltage to the relay and causing the LED lights to get about ~3V, so when turning the printer off, the LED lights get dimmer but don't actually turn off. I have tested putting a diode (IN5822) between the relay and the mainboard. This fixes the issue, however I'm concerned about the voltage drop over the diode will effect the mainboard (goes from 24V to about 23.4V)
Do you think this 0.6V drop would cause an issue with the mainboard (being "under voltage") Is there any other solution that could work better??? (I have also tested cutting the + wire in USB cable between Rpi and printer, but this does not resolve - in fact, from Octoprint I can't connect too it with this wire cut)