Automatically shut down the remote RPI via the smart socket

Hello,

I installed moode audio on an rpi3b and hung it with the receiver behind a smart socket. The socket can be switched in a dashboard. Switching on the system works easily. But if I want to switch everything off, I have to shut down the rpi separately first. How can I automate this? So

  • Press the switch in the dashboard
  • Send command to shut down rpi
  • Before switching off the socket, wait until the rpi has shut down (for example 20 seconds)
  • Switch off the socket

Try this guide Guide: Start up and shut down remote linux PC using Home Assistant – Creating Smart Home

then create an automation that triggers the shutdown command, wait for x seconds and then triggers the socket.