House flies aren't shy about hanging out in coffee shops, and some bugs (such as fruit flies) seem to enjoy hovering around an attractively damp coffee maker.
Pest control expert Guy Halvorsen shared with Homes & Gardens that, as a pest deterrent, coffee is most effective against mosquitoes, cockroaches, and ants — not flies.
Flies do hate smoke, which the coffee-burning hack theoretically produces. Unfortunately, when we tried this hack, the wick wouldn't stay lit and produced no smoke.
Assuming it's possible to burn the grounds successfully, this could be a helpful trick, but burning a citronella candle is probably a better idea to smoke out flies.