This is what we teach in self defense classes around here all the time. If someone is coming at you then you use whatever object you can grab and throw it at their head. This will cause attacker to throw up their hands or duck which will distract them for a second or two. During that crucial time then you can manuever out of the way. You want the attacker to lose their line of sight and slow their forward momentum.
The command voice is the first line of defense for everyone and will harden you as a target. It will also help pump that needed adrenaline into you to prepare for a physical fight. Yelling might scare or distract them. It will let them know that if they come in close their will be a fight. Sometimes yelling the right words can make the attacker think twice.
When defending yourself hand to hand then you have to remember the goal is trying to get away. Its not a prize fight and the goal is not to knock then out. Simply put, you are basically trying to distract and disorient to buy a few seconds so you can escape. There are some great self defense classes out there which are designed for women, but men can take away a lot from them. I paid to take this course out of my own pocket and learned a lot from it. It also teaches you how to handle multiple attackers in an ambush situation.
If someone came through my door right now while Im laying down on the couch with my laptop I know I would not be able to escape nor would I be able to go for my pistol or make a phonecall. The only thing I could do is throw whatever object I have in my hand and yell at the top of my lungs then try to escape. The general idea is evade, escape and resist.
There are specially built security screen doors with deadbolts which make home invasion more difficult. I have these on my home making the frontal attack on the entranceway less likely. Of course, there are other ways in like a rock through the window, but the security screen will at least close the entranceway loophole.