One way to keep them out of the house is to use a repellent, but if you like me you try to minimize your use of chemicals.
Hang a sprig in your door or make this handy tea and fill a mister bottle so you can spray your door and window frames.
Thyme Tea Fly Repellent
Brew one teaspoon of dried thyme in one cup of boiled water for about 10 minutes.
Let it cool, strain it and you have an effective, chemical free fly repellent you can spritz anywhere flies congregate.