The first thing is to detect the current flowing in the circuit. One way would be to have a current transformer/rectifier/amp driving a change over relay. One thing to remember is that you might want to change over to the mains when the current is greater then .2A, but you might have a heater so the maximum current could be 20A(?) so your circuitry must be able to handle this and not overheat (series resistors are not allowed!!). One way over this could be to get some diodes that can handle the maximum current and connect them cathode to anode in parallel, if you insert them in your mains, then the maximum volt drop would be +- 1.0V, and +-.6V at virtually no current. If you repeat this for every diode pair you multiply the voltages, so with two pairs it would be +- 2.0/+- 1.2V. If you have three pairs (+-3v/+-1.8V and connect an opto isolator via 470 ohms across the outside, then with a high current there would be enough voltage to turn the LED on and the transistor would conduct, with 1.8V there is not enough voltage and the transistor will remain off. Please be careful with this, it is best to do the current checking with a low voltage transformer that can deliver enough current. Also your diode string should be in the neutral line to make the opto isolator safer to handle.
Frank