Use a pressure sensor, once the tank is full and the ball cock closes the pressure builds up in the pipe, pressure senor trips telling pump to stop dumping, once the pressure drops, tells the pump to start pumping again. or just have an overflow on the tank as sun is free.