I’m currently working on generators, after doing a lot of research on them. You’ll find them in sheds, garages and storage units in Build 32. They’re not all that rare BUT they do require certain skills to operate them. As such, an electrician will know how to use a generator, but an average joe will have to get some reading done!
If you know how to operate them, however, then you can carry them [although they are really heavy!] to the outside of your safehouse, plug it in and turn it on. A wise survivor, however, probably won’t place it inside the house as, yes, the threat of poisoning will be very real. Electricity will then be provided in the home – and the generator will slowly consume fuel and lose condition as it does so. Fuel itself will be obtainable at any gas pump in the game, while there’s still electricity to pump it. Comfort does have a price though, and users should be aware that generators make a hell of a lot of noise, and might get a bit explode-y and fire-y should their condition deteriorate to dangerous levels.