There are ways, and then there are ways.
For a small system, you may be best to make your own internal grid ( you may hook up half a dozen energy users to an inverter), and use a ups solution.
Ie use an extension lead and power boards to drive your loads from the inverter direct, and get a inverter that does UPS function ( not PJ... very suspect in that orientation). That way, when ever your battery is down, the inverter just switches in the grid, and bypasses the ups inverter during those times battery power is low.... some inverters will try to charge the batteries as well at this time... if you want?
This circumvents any official complaints, as thats how you use your computer UPS as well.
Wiring to the fuse box is a different matter entirely, and you will need a double pole double throw switching arrangement... simple and effective.
Using a double throw double pole switch/relay, makes it impossible to power the grid from the inverter, as it never sees the mains connection.... and a PJ could be used in this circumstance, as it is just being asked to be an inverter, and nothing else.
Will probably need a licenced elec to wire it in, and labelled switch gear with approvals..... depends what country you are in as to how much grief you will cause if your inverter is not UL listed etc. Most of the world will probably not care, but developed countries may be problematic with insurance etc..... they love red tape.
............oztules