Smart home technology frees us from all the hard work in the home and enables us to live in an efficient and convenient residential environment. To fully take advantage of smart home, various household information, especially home environment information and user's living patterns, are collected, processed and exploited at the environment. A sensor and actuator network, which is usually constructed in a mesh topology, has been usually deployed to collect these information. In this paper, we propose a self-configuring, self-regulating topology switch algorithm for such the network, so that the resulting network provides a personalized environment for users. To construct this algorithm, we selected some parameters that reflect home's environmental property and user's propensity. We then conducted a simulation study with some scenarios which can be observed in real smart home to verify the proposed algorithm. Simulation results show that the algorithm can improve both the network connectivity and efficiency, and provide personalized home environment for users.