I made this schematic based on my battery backup system, I though it may be useful to someone else that is looking for it. I did it in a way that the power inverter comes on only when the main power goes out. I used two relays on my system: One to turn on the power inverter when the main power goes out, and the other one is a DPDT time delay relay to off, which it waits 10 seconds before it switches to the inverter output thus giving enough time for the inverter to turn on without a load.