If you want to control the switch off from a microcontroller, simplest approach is to use an AC mains push button. Bypass the button with an SSR controlled by the microcontroller.
Could you elaborate? I have a push button and SSR in parallel. Push button does not preserve the state, right? AC will flow as long as the button is pressed. Let's assume the device is not powered and SSR is off. So while AC is on (when I pressed the push button) I need to flip SSR so it allows AC as well. This means that I need something that works only when SSR is off, but the power is on. And then I need something to detect the press when the device is powered to unpower it.
This seems like something I should not be inventing. I know my Keurig coffee maker has this functionality (my wife will not forgive me if I take it apart