If you have a single-family home then a whole house generator with an automated transfer switch makes sense. In a townhome there may not be the space in the backyard for it, plus there are usually strict HOA covenants.
I'm in the process of installing a battery backup / solar array tied into the grid at my home. I've got the batteries, inverter/controller comes next, solar panels will be last. Fortunately I have friends in that biz who are (literally) hooking me up so I'm looking at an ROI of around three years rather than the typical 8-10.