Sorry Tedster, but in California, at least, you’re certainly not required to “leave your home.” You’re probably thinking of something called the “retreat rule” which was a common law rule describing when it was acceptable to use deadly force in self defense. I don’t believe any state impose a duty to retreat when you are inside your home.
It’s been codified in California in Penal Code 198.5 as Might Maximo pointed out. Statutes aren’t the easiest thing to parse so I’ll highlight the relevant sections.
Any person using force intended or likely to cause death or great bodily injury within his or her residence shall be presumed to have held a reasonable fear of imminent peril of death or great bodily injury to self, family, or a member of the household when that force is used against another person, not a member of the family or household, who unlawfully and forcibly enters or has unlawfully and forcibly entered the residence . . .
Translation: If someone breaks into your house, there is a presumption that they are going to harm you.
This law was passed back in the 80’s along with similar laws in several other states. They were commonly known as “Make My Day” laws which pretty much says it all.