Smart buildings play a crucial role in optimizing energy management within the power network. As end-users of the power network, they have the ability to not only reduce economic costs for householders but also modify the technical indices of the power network. To promote efficient device management in smart homes (SH), demand response programs are recommended for consumers. This research investigates the application of clustering-based electricity pricing strategy aimed at effectively managing the energy devices of a residential smart home. The utilized method categorizes the electricity tariff into five rates according to the clustering of the real-time pricing program. Ward’s clustering method is utilized to cluster and determine new electricity tariffs. The primary goal of the energy management program is to minimize the building’s energy cost, which is accomplished through the utilization of the multi-verse optimizer. The smart home consists of essential and manageable appliances, a photovoltaic panel (PV), a sodium-sulfur (NaS) battery, and an electric vehicle (EV). The initial parameters of the PV and EV are modeled stochastically by their probability distribution functions and calculated using the Latin hypercube sampling algorithm. The smart building’s performance is assessed by taking into account various demand response programs. The numerical results present that the application of the clustering-based management method has resulted in a significant reduction of 23–43 % in the electricity cost of smart homes. Additionally, the smart home exhibits a more linear consumption pattern when considering the electricity tariffs based on the clustering approach.