As an important application domain of wireless sensor networks (WSN), wireless home sensor network (WHSN) can be built as a traditional WSN. However, when we consider its own character that plug-in sensors are �xed with AC power supply while mobile sensors are battery powered, traditional WSN techniques do not match well. In this paper, we propose a smart wireless home sensor network architecture with improved routing protocols. It is a hierarchical architecture in which AC-powered sensors act as backbone nodes for data retransmission, while battery-powered sensors act as leaves that only transmit data relevant to themselves. Each sensor is assigned with a prime number as its location identi�er. For our routing algorithm, the LID is used as routing address and is decomposed to a sequence of prime numbers that indicates the route towards its destination. In addition, we improve existing routing algorithms such as SPIN, LEACH, and DD to incorporate traditional WSN routing algorithms into our smart WHSN architecture, and comparable efficiencies are made between them. Moreover, we propose a network path recovery algorithm for failures that are caused by node mobility or backbone node failures. All our algorithms have been provided with faithful simulations to verify the feasibility and efficiency.