Connect the battery first (with correct polarity — red to positive, black to negative). Then connect AC input from mains. Last, connect your loads (lights, fans, routers). Reversing this order can damage the internal transfer relay.