You may not use deadly force just because you are in danger or even if you reasonably fear that your life is in danger. In most states, you must have a reasonable fear of imminent peril of death or great bodily injury. In most metropolitan areas your life is in in danger whenever you get on a freeway, but not imminent danger.
Whether or not your you held such a fear and if it was reasonable is a question of fact. If at 3 in the morning the person is on the other side of a door chambering a round and taking a stance to kick in your door, all of which you saw on a security monitor, I think law enforcement and a jury might buy justifiable homicide. If you didn't know that they were chambering a round or were even armed or that they were preparing to kick in the door, you may need a good criminal defense attorney.
The first paragraph was good, if a bit overly specific for this discussion, but then you lost it in the 2nd paragraph. "Taking a stance" to kick a door is hardly imminent danger. Plus either way, you are probably going to need a good criminal defense attorney as a matter of SOP for a self defense shooting.