Frome residents have won their battle to prevent a “hazardous” battery energy storage site near a busy residential area.