Coffee grounds do attract some mice, although some mice are deterred by the coffee grounds.
The strong smell of coffee grounds can act as a deterrent for some mice, but they are not foolproof as some mice ignore the coffee grounds and still may try to eat the coffee grounds or still cross the coffee grounds.
Rodents like mice, usually don't like caffeine, and so the coffee grounds can sometimes disrupt the navigation of the mice and be a part of a repellent strategy, but there's not guarantee it will work for all mice.
It's better to use mice traps, including glue traps and sometimes mice poison to fully get rid of the mice.
If you have a really bad mice infestation, it may be best to call a pest control service who has more ways of getting rid of the mice.
Roaches also tend to like coffee grounds as well, so the coffee grounds could also attract roaches, which are even harder to get rid of than the mice.
The smells that mice hate are pungent and strong, irritating smells, like peppermint oil, clove oil, cinnamon, cayenne pepper or capsaicin, eucalyptus and even cedar.
These smells are good mice repellents as they overpower the mice's sensitive noses and disrupt the mice's scent trails, which make the mice avoid areas where these scents are also present.
And harsh chemical odors like vinegar and ammonia, also repel mice, although they should be used with caution as they have potential health hazards.
Ammonia and vinegar mimic predator urine, which trigger a mice's flight instinct, but they should be used in well ventilated areas.
Cedarwood, has a strong aroma that acts as a natural mice deterrent.
Eucalyptus oil is another essential oil that is potent and masks food smells and mice hate the smell of eucalyptus oil as well.
The capsaicin in cayenne pepper also irritates the mice's mucous membranes and repels them.
Clove and cinnamon are pungent spices that mice find very unpleasant and so they will avoid areas were clove and cinnamon are.
And peppermint oil has a strong menthol scent that overstimulates the mice's nasal passages.
You can repel mice with these scents by soaking cotton balls in some essential oils like clove, peppermint, eucalyptus and cedar oils and then place the soaked cotton balls in corners near entry points and in pantries.
And or sprinkle some powdered cayenne pepper or cinnamon near suspected mouse activity to repel the mice.
And even create some sprays to repel mice like mixing essential oils or vinegar with water and spray it onto surfaces.
Also because these scents fade, you must also reapply these scents regularly and smells only deter the mice, but won't eliminate the existing mice nests.