A couple of people have advocated complete subservience to armed home invasions, for fear that it might be a police raid. I remember the "Wichita Massacre" in Dec. of 2000. When two brothers, recently released from Jail went on a deadly crime spree culminating on the night of Dec 14, when they invaded a home where 5 people were holding a Christmas party. They were raped, robbed and shot execution style. One survived.
http://www.wichita-massacre.com/
Don't think complete subservience served them very well, (not blaming them, they were taken by surprise, and didn't have much choice).
Perhaps this thread properly belongs in the "activism" forum, as it seems the best way to prevent an errant S.W.A.T. Team raid is to reduce the number of such raids and raise the threshold for such a raid to be considered. That requires political activism.
The police have an obligation to announce their presence. Sadly this sometimes does not happen, again, this require political/legal activism to force a change of the rules, or to ensure they are enforced.
If you have time or opportunity to identify an errant S.W.A.T. Team for what it is, one should of course, surrender, and sue the heck out of them in court.
If we merely consider how to respond to an armed home invasion, that is simple! Shoot as many of them as you can, as fast as you can. Tactics are how best to accomplish this.
Considering tactics and strategies against an armed home invasion, a dog would probably be a good idea, even one of those little yappity dogs would be quite capable of giving warning. Some training of the dog might be required. Keeping a weapon close to hand would be another. They make holsters for beds, so you don't have to keep it under the pillow or on a night stand. Carrying around the house can be a bit inconvenient, stashing guns where they are convenient to reach is a solution, but depends a lot on if there are young children present or not. There are various types of ready access safes available.