Of course you can and it does not have to be overly complicated either. Most Inverter Companies make Inverter/Chargers which accept not only grid power and auto-switch on/off but also can auto-start a generator & accept Solar / Wind input. These can be programmed for various modes, such as; UPS Mode if grid power fails, auto-switch to battery, Battery Mode switching to Grid if batteries reach threshold OR start a Generator.
Inverter / Charger combinations are very efficient and effective with a wide possibility of programming them to suit your needs. I use a Samlex EVO-4024 for my home and it's great ! They have a variety of them and several new models (including stackable inverters) are coming for 2020. REF LINK:
https://www.samlexamerica.com/products/ProductsList.aspx?cid=S51
One word of caution / advice. Using various brands of gear can become a management & control nightmare. Many systems have Modbus, CanBus or proprietary communications... Modbus & CanBus are open and common with many companies and can simplify integration & management.
A Genset which works well in such a scenario while being Budget Friendly are the Champion Home Stand-by generators which use LPG (Propane) that can sit for ages without souring (some can be connected to Natural Gas as well). Connect that Auto-Start switch to the Inverter/Charger and enable it's function & set the thresholds.
REF:
https://www.championpowerequipment.com/products/generators/home-standby-generators/
You can go one step up and go for a complete solution ! As some companies, Even Chinese Quality OEMS are now manufacturing these on scale as demand is going through the roof, it's also good as prices are falling fast in this area. Have a look at TWO Chinese Companies that are High Quality OEM's
Most grid-tie PV systems are useless when the grid fails. They shut down at the very moment that the power is most needed. This does not need to be the case. One way to ensure that a PV array does not become stranded during utility outages is to make it AC COUPLED back up system. AC Coupled...
www.sigineer.com
https://www.yiyen.com/product/battery-energy-storage-system-ess/ DIRECT or
https://wholesaler.alibaba.com/wholesale/search?SearchText=yiyen
My Own system has a Samlex EVO-4024 for my home. A Yiyen APS-3024 Combi Inverter/Charger as secondary (going to greenhouse) and while I have not uised Sigineer myself, I know a few who have and absolutely love them.
Lastly & most importantly. Always stick to LOW FREQUENCY Pure Sine and avoid High Frequency Inverters (cheasper and do not handfle motors, pumps etc well) REF:
Inversion Methods Explained: High Frequency vs Low Frequency
https://www.magnum-dimensions.com/k...rsion-methods-explained-high-frequency-vs-low