Automate start/stop of a power generator

sonnyyu:
This is not necessary true

I strongly disagree.

If you connect your own AC power supply to the mains WITHOUT PERMISSION AND APPROVAL FROM YOUR ELECTRICITY SUPPLIER then it can be extremely dangerous and might even be illegal in some situations. There are lots of conditions that have to be met for this to be done safely. Simply connecting a generator output to the mains absolutely is not safe. Connecting it via a grid feed-in unit of the sort you show is also NOT SAFE unless your electrical supplier has explicitly authorised that, and that pretty much means that they will have installed it for you. Suffice to say if you know how to do that safely, you won't be coming to forums like this asking for advice on how to do it. For anyone asking here, the only safe answer is that you must not allow your generator to connect to the incoming mains supply under any circumstances. The most reliable way to ensure that IMO is to have a mechanical switchover system wired so that it is physically impossible for the two sources to be connected together.