RPiMP - Raspberry Pi Manager of Power

To manage the Power of an RPi, I created a small tool that provides the management of the power state through an ESPHome managed smart plug, in my case a sonoff s26. The ESP device can automatically boot and shutdown the RPi, or this can be done by manually switching the power on and off (by switching the power button of the smart plug).

On the RPi a service is running that monitors changes on the ESP device. If the delay switch is turned off, the RPi will shutdown. Just before that happens, another delay switch (the real delay switch) is switched to off and will cut the power after 15 seconds, assuming shutdown of the RPi has commenced.

In a nutshell: this as a substitute for a power button and WoL for your RPi