for a really low tech fix, try this.
connect the output of the inverter to a continuous duty ac relay.
connect the loads you want to run on the inverter to the contacts that will be closed when the relay is turned on.
the other set of contacts to the mains. (be damn sure you install the required fuses and or circuit breakers)
when the battery runs down and the inverter can no longer supply power to your loads, the inverter will shut down.
when it does, the relay will drop out and the loads that were running on the inverter will now be operated from the mains.
when the solar panels get the battery back up, provided the inverter automatically resets, then the relay pulls in and you're back on inverter power.
remember safety first!
If you get the output of the inverter connected to the grid, you'll let the smoke out of the inverter.
and the relay you need will be a high quality industrial strength unit...nothing from radio shack!