I would have a couple worries using coffee grounds directly on house plants:
1. A layer of coffee grounds could encourage fungal infections and protect and incubate insects
2. Coffee grounds are acidic. Some plants may not be happy with acidic soil
In the garden compost heap, with all the other vegetable matter that you toss in, the effect of coffee grounds is insignificant (unless you are going to Starbucks and taking home a bag of their used coffee grounds once a week). You can counter the acidity in the compost pile by adding a couple bags of manure, an alkaline - a good practice anyway.
Daisy