No – or at least not unless you have huge amounts. I’ve certainly had to deal with rats myself despite regularly adding coffee grounds to my compost bins. Indeed, some scientists have even managed to get rats to eat coffee grounds by replacing part of their corn with coffee grounds.