Re: @YetAnotherLocksmith
er.. the common or garden UPS has been doing exactly that for years. Mains goes off - UPS alternates independently. Mains goes on - UPS slews the phase of the generated output to match the mains in, then switches over to live input.
I had an old APC unit which would cold-start without a power input. It would run at 60hz. When the mains was connected, you could hear it hunting around to achieve 50hz, mains phase before switching to live.