The use of wireless sensor networks in home automation (WSNHA) is a growing trend, on account of their self-organisation, low cost and potential for rapid deployment. Routing in WSNHA is a challenging research topic, because of the requirements of low energy consumption, low storage, low computational complexity, fast response, self-adaptation to unpredictable topological changes and robustness with respect to discontinuous interference. With the development of localisation techniques, localised routing offers a number of attractive benefits, but not all are suitable for WSNHA. In this study, the authors propose a new routing algorithm for WSNHA, called WSNHA-GAHR (greedy and A* heuristic routing for WSNHA). The algorithm uses greedy forwarding, based on the smallest Euclidean distance, to minimise the number of hops for data packet transmission, and thus conserve energy. It also automatically adjusts the route, using the A* heuristic algorithm, when local minimum problems and unpredictable topological changes occur in WSNHA. In addition, link priority classification gives WSNHA-GAHR a greater tolerance than ZigBee routing algorithm for discontinuous interference. Simulation results show that this routing protocol dramatically improves reliability and reduces average packet delay, without introducing additional overhead.