Smart home devices generate a substantial amount of local data, and finding effective ways to utilize this data while ensuring privacy has become an increasingly pressing concern. Technologies such as Smart Homes, Federated Learning and Blockchain offer promising solutions to address this challenge. We introduce a blockchain-based federated learning approach that leverages edge nodes to maintain a decentralized blockchain, thus mitigating the risks associated with single points of failure. Furthermore, this method utilizes local data from home IoT devices for model training, ensuring efficient learning while preserving data privacy. To address the challenges posed by non-independent and homogeneous data distribution, we propose a clustering method. This strategy effectively tackles the issues arising from non-homogeneous data distribution, consequently improving model accuracy. Finally, experimental results demonstrate that our proposed approach significantly enhances model accuracy and generalization while safeguarding user privacy.