https://www.home-assistant.io/integrations/wake_on_lan/ and https://www.home-assistant.io/integrations/shell_command/ with `ssh server poweroff` if you want something a bit less risky
measure the power draw from your smart plug when the machine is on & off, then use that to set up https://www.home-assistant.io/integrations/switch.template/ which combines all of this